At 02:17 PM 04/05/2000, Oliver Schleede wrote:
>i'm sure there are a lot out there with not the slightest idea why their 
>perl script don't work because the documentation only serves the already 
>knowing. 

The Perl docs are tough on newbies, yes.  But so are the PHP docs.  Quick:
how do you tell the difference between zero, the empty string and the
undefined value in PHP?  That's quite useful for parsing web forms, you know.

>php3 is much more efficient there, no mdoules, allalready onboard 

Well, there are certain things that *seem* easier in PHP than in Perl-CGI,
because they've already been pre-compiled into the executable.  So, for
instance, you don't need to figure out how to install and use DBI.  But
next year when you switch databases, have fun converting your mysql_* based
pages into pg_* based ones. 

There are other reasons that PHP has caught on as a web scripting language:
 Built in form processing.  No need to tweak file attributes on the server.
 Errors automatically to go to the browser, rather than some hidden logfile
somewhere.  These things make getting started easier.  I think it would be
nice if Perl installations were typically so newby-friendly.  I'd much
rather this than for web programmers to start ditching Perl for PHP.  

PHP's ease of use is really only skin deep.  Some basic things that you
take for granted in Perl are really painful to do in PHP.  Like reversing
an array.  Or turning an array into a hash.  Or using private variables.
Or catching typos with 'strict' mode.  Or moving your commonly used code
into modules.  Or reading a text file.  

Have you ever tried to read a text file in PHP?  It's like programming in
C!  Bleah!

And then there are things that look easier in PHP but turn out to be too
limited to be actually useful.  For instance, you can open URLs via
fopen('http://server.com/').   This certainly seems much easier than
figuring out how to use Perl's LWP modules.  But unfortunately, fopen()
won't follow redirects or handle SSL, so you're stuck if you want to use it
in the real world.  

Similarly, you can use get_meta_tags() to parse out the META tags from an
HTML page, but the function is sensitive to quote characters and line
endings, so again, you can't use it with the actual pages you retrieve from
the web.  Of course both fopen() and get_meta_tags() are written in C, in
case you wanted to fix them.  

For my part, I've written my own http_get() function in PHP, and I've also
learned how to use LWP.  I have to say that it took me much less time to
learn LWP, and I got far more benefit out of it in the long run.

People say that PHP's strength is that its syntax is simpler than Perl.
Well it's true that it's simpler, but I'd disagree about it being better.
There's no foreach loop, for example, and no <<HEREDOC or alternate quote
characters.   
As for regular expressions, sure they got rid of all those ugly regexp
operators, but they kept the ugly regexps, and then wrapped them up into
nine distinct function calls.  Now that's simple.

All ranting aside, I think that the Perl community can learn a lot from the
success of PHP.  PHP *seems* easier than Perl to a lot of people, and
seeming is important, if we are to introduce more new programmers to Perl.  

Part of the philosophy behind Perl's language design is that beginners
should be able to speak Perl babytalk and still write useful programs.  And
then they should also be able to make much more useful programs as they
become more fluent.  I still think Perl is a good first programming
language for this reason.  And Perl's popularity as a CGI scripting
language made it the first language for many programmers.  Now it is
beginning to looks as if PHP is starting to encroach on that niche, and I
don't think that's a very good thing at all.

Michael


-- 
Michael Graham
[EMAIL PROTECTED]

---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
         [EMAIL PROTECTED]
For non-automated Mailing List support, send email to  
         [EMAIL PROTECTED]

Reply via email to