LPM: "" interpolates method calls?

Rich Bowen rbowen at rcbowen.com
Sat Nov 27 15:38:31 CST 1999


I'm really confused, and I've been banging my head on this one for about
an hour, so perhaps I'm looking right at the answer. Usually, the
fastest way to find an answer is to publically humiliate myself by
asking a stupid question - I invariably figure out the answer about 3
seconds after pressing "Send."

Anyways, here's the dilemma. I have something like this:

	$table = $foo->method
	$sth = $dbh->prepare("select * from $table
				order by date_time desc");

And that works. $foo is a object from the Baz::Mumble class, and method
is a method in that class. Pretty straight forward.

The problem is that when I do:

	$sth = $dbh->prepare("select * from $foo->method
				order by date_time desc");

I get:

DBD::mysql::st execute failed: You have an error in your SQL syntax near
'::Mumble
=HASH(0x8204798)->method

Which seems to mean to me that $foo is getting interpolated in the "",
but $foo->method is not. How do I get $foo->method to get correctly
called inside of ""?

More specifically, without getting DBI in the way, I have:

print $foo->method; # Produced the expected result
print "$foo->method"; # Produced "::Mumble=HASH(0x8204798)->method"

TIA, and I'll let you know when I figure out the answer in 3 seconds. I
hope.

Rich
-- 
http://www.ApacheUnleashed.com/
Lexington Perl Mongers - http://lexington.pm.org/
PGP Key - http://www.rcbowen.com/pgp.txt



More information about the Lexington-pm mailing list