Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
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
Node Status?
node history
Node Type: note [id://61737]
help
Chatterbox?
erix considers showing this to choroba , thinks better of it
[choroba]: LanX we used to mock Hare Krishna processions signing "Hare Rama" carrying the margarine conatiners
[choroba]: :-D
[LanX]: What about Czech an Chechen ambessy?
[AnomalousMonk]: LanX: Rama had (has?) a high (much higher than typical asteroid) rate of axial (again, unusual, I think) spin for its artificial gravity.
LanX pity there is no Germs embassy ...
[choroba]: LanX We merged them to save money.

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (9)
As of 2017-11-22 17:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (327 votes). Check out past polls.

    Notices?