I'm confused by your question. If you're using the function oriented interface (and you appear to be), instantiating a CGI object is useless. Try this:
use CGI qw/:standard/; # vvv note the equals sign my $html = p($font_o,'---[', b('Handle: '),$gbdata->{'handle'},br(),'----[', b('Email: '),$gbdata->{'email'},br(),'-----[', b('Website: '),$gbdata->{'url'},br(),'------[', b('IP: '),remote_host(),':',server_port(), br(),'-------[', b('Browser: '),user_agent(),br(),'--------[', b('Date & Time: '),$time, br(),br(),'[', b('Message'),']',br(), hr(),$gbdata->{'comments'},br(),hr(),'</font>',), end_html(); unshift (@contents, $header, $html);
That's what I think you mean. If you want to know how to assign separate HTML elements to an array, one way to do it is to use CGI::Pretty and split on the newlines.
use strict; use CGI::Pretty qw/:standard/; use Data::Dumper; my @contents = split /\n/, b('<font face="arial">','---[', b('Handle: '),'Ovid',br(),'----[', b('Email: '),'ovid@ovidinexile.com',br(),'-----[', b('Website: '),'http://www.ovidinexile.com/',br(),'------[', b('IP: '),remote_host(),':',server_port(), br(),'-------[', b('Date & Time: '),scalar localtime, br(),br(),'[', b('Message'),']',br(), hr(),'Comments, anyone?',br(),hr(),'</font>',), end_html(); print Dumper \@contents;
The second answer isn't perfect, but I don't think it was what you were looking for, anyway :)
Cheers,
Ovid
Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.
In reply to (Ovid) Re: Assigning CGI object data
by Ovid
in thread Assigning CGI object data
by s0ttle
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |