I've done lots of perl CGI programming but I thought I'd give php a whirl.

I started with a vendor supplied form that had php code and html all on one page. Quite a mess I thought, so I immediately used the Smarty template engine to bring some order to the party.

Then it hit me, that once you separate the php from the html, the php script could very well be a perl cgi script. They are invoked the same way from an html <form> tag. Yeah, I know how php is integrated into apache, and speed, etc.

One thing I really like about php is the support for sessions. I thought that was missing from perl until I went over to CPAN and found a CGI::Session library, that quite frankly, provides better support for sessions than php, unless I'm missing something. CGI::Session

For instance, I was on a php mailing list and a poster there wanted to know how to expire a session. Apparently in php there is no call similar to this in CGI::Session: $session->expire('+1M'); # expire after a month. Instead you have to save a timestamp as a session variable and then go test it yourself.

Plus there's like 4 functions to do what split() does. One handles only regex's, another doesn't, etc. What's up with that?

I'm just about paralyzed now, I can't work on my project any more because I don't see what php is buying me. The fun I was having with php is gone, vanished, dried up. Now I'm in questioning mode. Full of doubt. And that's why I've come to the Perl Monks.

I've read countless posts comparing php and perl. If you check out some of the php sites they want to rewrite the whole world in php (one guy even wants to replace cvs with a php hack). It feels like a purge, a re-writing of history. Friends have told me "greg, perl is old school. get with the future - learn php". :-)

Ok, there's a certain amount of humour in all this I'll admit, but I don't understand all the hype.


In reply to php + Smarty looks like CGI by Anonymous Monk

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!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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, details, 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, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            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.