Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Re: Perl & Personal Web Server

by mkmcconn (Chaplain)
on Mar 02, 2001 at 07:10 UTC ( #61737=note: print w/ replies, xml ) Need Help??


in reply to Re: Perl & Personal Web Server
in thread Perl & Personal Web Server

Nice post, dws. Shouldn't you get the youngsters off to a good start, though, with a rudimentary CGI module script?

#!/usr/bin/perl -w use strict; use CGI qw(:standard); print CGI::header(),"\n\n"; print CGI::start_html(),"\n\n"; print CGI::start_table(); print CGI::Tr(CGI::th({-align => 'left'},['KEY','VALUE'])),"\n\n"; foreach my $key (sort keys %ENV ) { print CGI::Tr( CGI::td( {-align => 'left'},[$key ,$ENV{$key}])), +"\n"; } print CGI::end_table(),"\n\n"; print CGI::end_html();

That way, the point is drilled in verbosely, to use CGI. :-)

And incidentally, for posterity, it will come in handy to visit this link.

mkmcconn


Comment on Re: Re: Perl & Personal Web Server
Download Code
Ugly code! :-(
by orkysoft (Friar) on Mar 02, 2001 at 09:51 UTC
    I'd do it like this:
    #!/usr/bin/perl -w use CGI; my $q = new CGI; print $q->header, $q->start_html, $q->start_table; # etc
    Okay, so actually this requires more finger acrobatics, but at least it looks a lot better to me. But then, 'an old version of Perl' might very well mean Perl 4, which doesn't have OO. (But that's before my time, I believe I've just missed my first Perl anniversary ;-)

      Of course it looks much better that way, orkysoft. Not to take any points away from beauty, the point was be 'verbose' in reminding beginners to 'use CGI'.

      A bit of (I'd hoped) useful (but dubitable) humor, you see. :-)
      mkmcconn

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (8)
As of 2014-08-28 06:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (257 votes), past polls