Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
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

Replies are listed 'Best First'.
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
Domain Nodelet?
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 perusing the Monastery: (3)
As of 2023-03-24 18:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which type of climate do you prefer to live in?






    Results (61 votes). Check out past polls.

    Notices?