LPM: "" interpolates method calls?

Rich Bowen rbowen at rcbowen.com
Sun Nov 28 15:42:57 CST 1999


Michael Wallace wrote:
> 
> I'm working on a database project right now and I have seen some similar
> stuff happen.  I don't know why $foo->method isn't interpolated, but I
> think I got around it just by doing:
> 
> $sth = $dbh->prepare("select * from " . $foo->method .
>     " order by date_time desc");

Important note there. This did not work for me at first, because I was
being a dodo-head (technical term) and had:

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

Note lack of spaces before and after $foo->method, which causes things
to break. Languages that care about whitespace irritate me!

> That I wish I knew.  When you figure it out in three seconds, I think all
> of us would like to know. :)

Well the answer was, as usual, to RTFM before spending an hour trying to
figure it out. And, the corollary to that is, if something appears
amazingly complicated, and you're working with Perl, you are clearly
thinking about it wrong. Easy things easy, hard things possible. I just
get so wrapped up in trying to solve things like this that I waste
entire afternoons on it, which really aggravates me.

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