Thanks to Rob for his Class::DBI suggestion earlier. Looks like what I
needed was simply:
my %hash;
return $sth->fetchall_arrayref(\%hash);
to return an array of hashes...
As I'm continuing with my latest project, I'm finding myself wishing I could
do some PHP type things...specifically, as I'm formatting the HTML there's
often a need to throw in spacer gifs of various dimensions to make things
look pretty...
In PHP this can be streamlined by creating a function which prints out your
image tag for your and accepts the height and width as parameters. like so:
function spacer($y,$x){
?><img src="spacer.gif" height="<?=$y?>" width="<?=$x?>"><?
}
To call it, you would just say:
<?spacer(10,50)?>
and it would throw in an image tag with a height of 10 and a width of
50...or whatever.
My question is this:
i'd like to be able to use the "print<<eof;" behavior to send large blocks
of HTML to the browser. Is there A way that I can reroute that statement to
send my string through a sub that basically does the following:
sub sendit{
my $txt = shift;
$txt =~ s/<\?(.+?)\?>/(?{eval($1)})/g; #evaluate what's between my
<??> delimeters and print the result
print $txt;
}
I know I could say:
my $var<<eof;
some HTML with some
PHP-type function in it<?someSub(50)?>
haha!
eof
sendit($var);
BUT that seems like a lot to type...I wish I could just say:
sendit<<eof;
somHTML with some
PHP-type function in it<?someSub(50)?>
haha!
eof
and have "sendit()" parse and execute my <??> piece and print the result.
But, alas, that seems to start a never ending perl child...
Thanks once again for any sage wisdom you may have.
-peter
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]