PHP and the web

David A. Sinck plug-discuss@lists.PLUG.phoenix.az.us
Wed, 11 Apr 2001 07:39:26 -0700


\_ SMTP quoth David P. Schwartz on 4/10/2001 12:18 as having spake thusly:
\_
\_ > \_ Another aspect is whether to have separate scripts for handling
\_ > \_ GETs and POSTs for the same screen.
\_ >
\_ > What?  Please show me the debate thread on this.  Someone thinks its
\_ > better to have some scripts run when called as GETs and others when
\_ > POSTed?  I'd love to know how they convince a webserver to fork the
\_ > request based on method.  I've branched logic in the code based on
\_ > request_method, but never have separated two instances of requests to
\_ > separate scripts.
\_ >
\_ 
\_ Maybe I misstated something.  Perhaps there isn't much of a "debate".  I've
\_ got a few Perl books and they all routinely separate GET and POST processing
\_ for the same form into different CGI files.  I don't know anything about
\_ server forking; the script writers just specify different files in the <FORM
\_ ...> tags.

Weirdness, but ok.  Maybe they do it for pedagologicalistic reasons.
[English is a constructive language, right?]

\_ I prefer to handle the GET and POST processing for one form 
That's how every sane form I've seen handles it.

\_ The Perl code I've seen that handles [re-POSTing] in a single
\_ CGI file seems way convoluted to me.

See CGI.pm for a potentially cleaner way that by hand.

\_ If you've got a lot of Perl experience, then maybe all this is second nature
\_ to you.  

I, do in fact, resemble that remark.

\_ Debugging was a bitch -- I don't like having to search through my web
\_ logs to find error messages that never showed up in the HTTP stream.  

1) tail -f /etc/httpd/logs/error_log
2) What?  You want joe-blow malicious-surfer to see your errors?  Eeek. 


\_ Every book I've read says Perl was designed originally as a report
\_ printing language, which it appears it would be quite good at.  Its
\_ use as a CGI scripting language is a strange adaptation.  PHP is
\_ FAR more natural to use in that capacity.

Not if you call the CGI output a report.  :-)

\_ Anyway, the other thing I REALLY love about PHP that I forgot to mention is
\_ the way it integrates all the HTTP vars directly into the programmer's
\_ namespace.

Oooh...there's a point to argue on, but I'll leave it at: it's your
poison, drink it if you want.

\_ Look, I'm no language bigot.  

Me neither, actually, but as my neighbor said: screws are nails with
threads, and I tend to see Perl as the Hammer of Choice.  :-)

\_ If time == money, then Perl is a very costly language for me to
\_ use.  

There's the real motivation folks: money.  If it saves you time/money,
use that solution.  It's not whether your like the language, but if
you can get in, get out, and be done faster than other solution
paths. 

\_ It could be the coolest thing on the planet, 

Not while my fridge has beer at proper operating temperature in it.
:-)

David