in reply to Assigning CGI object data

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.

Replies are listed 'Best First'.
Re: (Ovid) Re: Assigning CGI object data
by s0ttle (Scribe) on Dec 29, 2001 at 04:52 UTC
    The answer was so close, yet I was so distant. Thanks

    This first is what I needed:
    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);


    -tengo mas que aprender