Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: using 'require' to insert code

by HyperZonk (Friar)
on Jul 23, 2001 at 06:48 UTC ( [id://98900]=note: print w/replies, xml ) Need Help??


in reply to using 'require' to insert code

If you need to keep the HTML coders happy by providing an external file that is as HTML-only as possible, perhaps you should consider just having that file in pure HTML, reading it in, and printing it. Like:
my @html; open(HTML,"<$TheHtmlFile"); @html = <HTML>; close HTML; print @html;
This presumes that you have already emitted the required HTTP header, of course, and will also work perfectly well when you move over to CGI.

Update: And note syn's reply below, particularly if the HTML file is large.

-HZ

Replies are listed 'Best First'.
Re: Re: using 'require' to insert code
by synapse0 (Pilgrim) on Jul 23, 2001 at 10:17 UTC
    Well, I have something to say to main poster and a reply to HZ.. To the main poster, start using CGI.pm it's really just as simple as:
    #!/usr/bin/perl -wT use CGI; my $cgi = new CGI; print $cgi->header;
    And then just throw in CGI specific code as you learn it.. but you don't *need* any more lines than that, and to know that you can grab POST and GET data by calling $cgi->param();
    As for the sample above.. there's no reason to put possibly large html files into a memory consuming array, better to just read them in and spit them out (unless of course the data needs to be manipulated):
    open(HTML, "<$htmlfile") || die "ouch $!"; print <HTML>; close(HTML);
    -Syn0

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://98900]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (1)
As of 2024-04-25 00:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found