Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

CGI and mod_perl vs PHP vs ruby on rails

by targetsmart (Curate)
on Nov 04, 2008 at 07:17 UTC ( [id://721293]=perlquestion: print w/replies, xml ) Need Help??

targetsmart has asked for the wisdom of the Perl Monks concerning the following question:

Hi monks, Initially(3 years before) I thought that php would be a better language for doing web programming, because most of my colleagues used that. After some 3 years of exposure to perl , i now feel that CGI or mod_perl would be a better choice(I am a newbie to CGI and mod_perl). Now if I see my colleagues, they are slowly moving from php to ruby on rails because of more agility. If any monk knows about the three different web languages, please give me a list of advantages and disadvantages of choosing anyone among the three languages. I am more interested to choose CGI and mod_perl, but I feel that before entering into this, I must know which is comparatively better language.

Replies are listed 'Best First'.
Re: CGI and mod_perl vs PHP vs ruby on rails
by CountZero (Bishop) on Nov 04, 2008 at 07:44 UTC
    There is no comparison between Perl and PHP.

    Perl is a general purpose computer language whereas PHP only works (and badly in my opinion) within the realm of dynamic web-site programming.

    I have never used Ruby, so I cannot comment, but here is short comparison between Perl and Ruby.

    I have been told that Catalyst is inspired by Ruby on Rails, but is (of course) much better!

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

      PHP only works (and badly in my opinion) within the realm of dynamic web-site programming.

      While I would not disagree with the sentiment, in the interests of accuracy it should be pointed out that PHP scripts can be run on the command line. You still have to wrap the stupid <?PHP ... ?> tags around the code, but aside from that it will run given #!, permissions, PATH, etc. Its a bit of a pig to do that on Windows, but even that is possible.
      It is true to say that PHP is rairly used anyware except on the web. The people who use PHP rather let it down as well - poor coding practice is rife.

      It might be worth pointing out that Perl on Rails being done by the Beeb href http://www.bbc.co.uk/blogs/radiolabs/2007/11/perl_on_rails.shtml
        Sorry but AFAIK Perl on Rails is vaporware. The main reason why the announcements got such a big audience are IMHO depictions of the pathetic development environment at the BBC.

        But did anyone ever see any code?

        Catalyst is IMHO very TIMTOWTDI flexible (e.g. allowing integration of all main CPAN templating systems) but heavy and requesting much knowledge and planing.

        If you are looking for a more Rails like monolithical approach in Perl you may want to have a look at Jifty or Mojo.

      The OP is asking specifically about the realm of dynamic web-site programming, so I'd say your first comment doesn't apply.

        And that is exactly why I made the point that Perl is much more than some sort of templating system for the web. We should not be pulled down to the level of what PHP does.

        CountZero

        A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Re: CGI and mod_perl vs PHP vs ruby on rails
by inman (Curate) on Nov 04, 2008 at 09:15 UTC
    If you are building this code commercially (i.e. someone is paying you and your colleagues to write the code) then there are many other considerations before you get to the "best language for the job" question. By the sounds of it, you are using a tool that does the job that you require at present and is supported in your production environment. The main considerations are whether your technical approach is fit for purpose (can you achieve the business goals?) and whether you can support the development and operation of the target environment (can you build, maintain and run it?).
Re: CGI and mod_perl vs PHP vs ruby on rails
by Lawliet (Curate) on Nov 04, 2008 at 19:58 UTC

    PHP is extremely easy to learn and use. Because of this, more than half of the internet is cluttered with garbage .php files.

    If you are doing this commercially (as someone above me asked), the unfortunate truth is you may be better off using PHP because others will be able to edit the program without much stress. On the other hand, it might be more efficient in the long run if you used Perl for reasons you can see here at the Monastery. And finally, Ruby is just a silly fad :o

    Also, you have to realize you are in a Perl Monastery; we are biased :P

    I'm so adjective, I verb nouns!

    chomp; # nom nom nom

Re: CGI and mod_perl vs PHP vs ruby on rails
by dsheroh (Monsignor) on Nov 04, 2008 at 17:52 UTC
    For the sake of completeness, you may want to look into "the four different web languages" rather than just three... You left out Python, which also seems to get lumped in with Perl, PHP, and Ruby as well.

    As for actually answering the question, I have little bad to say about Perl, little good to say about PHP, and little at all (because I've never used them) to say about Ruby or Python.

Re: CGI and mod_perl vs PHP vs ruby on rails
by draegtun (Scribe) on Nov 06, 2008 at 12:14 UTC
    Have a look at Squatting.

    Its a web microframework so sits somewhere nicely between CGI/mod_perl and full blown frameworks like Catalyst, Jifty & Mojolicious.

    /I3az/

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://721293]
Approved by Sixtease
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2024-03-28 19:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found