Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

php to perl

by parasew (Beadle)
on Dec 31, 2002 at 00:50 UTC ( #223225=perlquestion: print w/ replies, xml ) Need Help??
parasew has asked for the wisdom of the Perl Monks concerning the following question:

searching google for "switching from php to perl", i found it quite strange, which results i get. most tutorials are existing for using php if you are a perl programmer. actually i didn't find any tutorial for the other way round, not even on perldoc.
my question now: is there such a tutorial existing, and if so, why not linking it from the perlmonks site, or at least somewhere?
i am working with php for more than 2 years now, and right now decided switching to perl mainly because i wanted to use one language, which is capable of creating web-content as well as system tasks, such as shellscripts. php has ways to use it as an interpreter for the console, but compared to perl it looks like a children's toy. the next issue is CPAN vs PEAR.
all in all i think such an tutorial would be very handy, and actually i don't know why anyone would switch back from perl to php ;)

Comment on php to perl
Re: php to perl
by simon.proctor (Vicar) on Dec 31, 2002 at 01:11 UTC
    Perhaps this is a case for writing Apache::PHP or some such module?

    Seriously though, to convince people to move back from PHP to Perl would be quite a task. You would have to provide case studies on similar tasks and how easier/better/more scalable it is in Perl, how you did it and what the person would have to do/install to do it too.

    Also bear in mind that the user is going to have to use mod_perl in most cases to get the same kind of web content speed that mod_php + Zend provides. No small task and quite a step for someone dipping their toe. This is where, I think at least, is where your main problem will lie. Its very easy to get started with PHP and it looks enough like ASP for people to get started:
    <?php print "hi" ?>
    compared to (one example of many):
    use strict; use warnings; use CGI; my $q = CGI->new; print $q->header; print "hi";


    Ok, now before I risk getting flamed - I am not starting a code war (nor do I intend to) I am just implying to the unwashed masses the first will have a greater appeal. The same emulation in Perl can come via Mason, EmbPerl, Apache::Asp (et al) but all require more effort and in the case of Mason - require mod_perl to be compiled in rather than loaded as a DSO.

    This raises a question - what audience would you target with your tutorial. Web content builders? Sys admins? Medium size development houses? You also have to bear in mind there has been a lot of bad publicity about the slowness of the CGI protocol. To the untutored (sadly of which there are many) Perl and CGI are one and the same (yes I have been there :/). There are also a lot of misconceptions to overcome.

    I can just imagine someone being forced by some PHB to write a script to do a 5 min task in Java purely for this reason. I'm sure its happened :)

    My main driving reason for this is that there is a lot of web content (I'd hate to call it anything else) that vehemently supports moving from Perl to PHP (Python, Java, C# etc). This would have to be quite a comprehensive article or set of articles.

    No small task :). However, if you can think of a structured outline and propose it here I am sure you would get some interest. I'm not trying to be down on the idea, I think it is a good one and I would like to see it succeed. I just thought I'd share what I considered to be my thoughts on just how widespread the issues are.

    I'd help where possible for one.
(jeffa) Re: php to perl
by jeffa (Chancellor) on Dec 31, 2002 at 16:58 UTC
    I work for a local PHP webshop. Getting them to switch over to Perl is an uphill battle all the way, mainly because my boss thinks that having a PHP code base is more accessible to potential new employees. I don't share the same view, but i do like to get paid, so i don't complain much (coding in PHP is worth not having to sacrifice one or two hours out of my work day driving to the big city).

    Personally, i would love a PHP to Perl tutorial, and i have really considered writing one myself (or it's counterpart - PHP for Perl coders). PHP, for those who have not written web apps with it yet, can actually be nice. But ultimately i feel that PHP offers power to those who are not ready for it yet - it is just too easy to shoot your head off with PHP, especially if you have register_globals = 1 in your php.ini file (which i'll wager most sites unknowingly or uncarringly do). It does have PEAR, but PEAR is no CPAN. I can't remember who said it, but i believe that PHP really is not a scripting language ... it is a templating system. The fact that you can write shell scripts in PHP is merely a convenience - PHP was meant for the web.

    Like simon.proctor said, PHP enthusiasts are not going to like the slower CGI model - a tutorial would really have to delve into mod_perl to show the real power of Perl over PHP (and hence, graduates the 'tutorial' to a more advanced audience). I feel that the majority of PHP's audience are simply not ready that power or too reluctant to give Perl a fair chance. How many PHP programmers actually use preg instead of ereg? Ugh ... now i am starting to change my mind. :)

    Off topic: have you perused the PHP Cookbook yet? Essential for any PHP coder's library.

    jeffa

    L-LL-L--L-LL-L--L-LL-L--
    -R--R-RR-R--R-RR-R--R-RR
    B--B--B--B--B--B--B--B--
    H---H---H---H---H---H---
    (the triplet paradiddle with high-hat)
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (12)
As of 2014-07-28 10:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (196 votes), past polls