Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

Hm. Most of your points seem to come from an incomplete understanding of Perl. Let me address a couple of big ones:

  • PHP is built from the ground-up with database functionality built in, particularly MySQL functionality. Perl is not.

    Perl's database capabilities are impressive. DBI is a flexible system that supports Oracle, MySQL, Sybase, any ODBC source, and many more. Built upon it are things like the DBIx family of modules that allow for robust database access without writing SQL.

    Perl may not have had database support early in its life, but as it currently stands, its support is much more mature and robust than PHP's.

  • In Perl, however, programmers are encouraged to use print statements to generate the HTML. True it is possible to implement templates in Perl (with more difficulty than in PHP) to separate code and HTML, but 90% of sample Perl code on the web doesn't do that.

    Programmers are most decidedly not encouraged to use print statements to generate HTML. Programmers are encouraged to use Template Toolkit, HTML::Template, or other easy-to-use templating systems. Of course, Perl lets developers shoot themeselves in the foot -- but so does PHP.

    Later in the same point, you say "An important code management technique for programmers is separating code from data", and templating systems do that. Marking PHP code between <? and ?> is not separation of code and data -- it's inclusion of code (PHP) in data (HTML markup).

    Observe:

    <p>This is a paragraph with some <? print($generated_content) ?> in PH +P.</p>
    That's code right inside the data. Compare:
    <p>This is a paragraph with some <TMPL_VAR generated_content> using HT +ML::Template</p>

    That's a placeholder for code to act on. And that's separation of code and data.

  • Perl scripts tend to have more security holes. This is because PHP has built-in a lot of the internal operations of dealing with web page requests and serving information.

    True, PHP has web functionality in the core language since it was developed with the intent of being a web language. However, to suggest that dealing with page requests and serving information is something that each Perl developer has to deal with in their own way is naive. Included with every modern Perl distribution (that is, it's in the Perl core) is the CGI framework, which handles all of the web-request architecture. Trivially available from CPAN are such things as CGI::Application, CGI::Simple, the FastCGI extensions, even complete web-application frameworks like Mason and Catalyst.

  • PHP is easy to learn in comparison to Perl. ... The Perl style of programming is unique, and thus not universally applicable to or from other programming languages.

    PHP was developed with much of the Perl style in mind, and the styles between the two are very similar. PHP does allow a new developer to go from zero to web-enabled app very quickly (which has a lot to do with it's popularity for web apps, no doubt). However, nothing about PHP makes it easier to write good applications when compared to any other language.

    Perl's style of programming isn't that unique -- it's largely an amalgam of elements from various well-established languages. Perl was one of the first languages I learned, and I found that picking up PHP, Python, Java, and even C were made quite easy with a foundation in Perl. This is because these languages borrow from each other significantly.

  • Accessing web form variables in PHP is straightforward, but in Perl requires either detailed knowledge of either HTTP header formats or one of many Perl CGI libraries.

    Accessing web form variables in Perl is easy and straightforward as well. Perl was designed to be an all-purpose language, so yet you have to use a CGI module. But there isn't a whole lot of knowledge involved. Check it out:

    use CGI::Simple; #standard module import my $cgi = CGI::Simple->new; #standard object creation #now I need to get a copy of the userid form var my $userid = $cgi->param('userid');

    It's just an object accessor. If that's not straightforward enough:

    my %formvar = $cgi->Vars; my $userid = $formvar{userid};
  • PHP code tends to be more consistent and modular than Perl.

    That's just entirely a red herring. Consistency and modularity are no more difficult in Perl than in PHP (or vice-versa). It's up to each developer to be consistent and modular, and it has almost nothing to do with the language choice.

PHP does have some advantages over Perl for certain applications: for example, mod_php is ubiquitously available from inexpensive virtual-hosting providers compared to mod_perl. It is certainly worth comparing the languages in terms of when each is the best choice.

However, to simply assert that PHP is a better language than Perl is naive. Specifically, the justifications for that assertion that you supply above are ill-concieved.

<radiant.matrix>
A collection of thoughts and links from the minds of geeks
The Code that can be seen is not the true Code
I haven't found a problem yet that can't be solved by a well-placed trebuchet

In reply to Re^4: The REAL reason for why they choose PHP over Perl. by radiantmatrix
in thread The REAL reason for why they choose PHP over Perl. by Spidy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others perusing the Monastery: (5)
    As of 2014-08-02 02:46 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      Who would be the most fun to work for?















      Results (53 votes), past polls