Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

RE: Combining PHP and Perl

by swiftone (Curate)
on Oct 13, 2000 at 00:24 UTC ( [id://36499]=note: print w/replies, xml ) Need Help??


in reply to Combining PHP and Perl

Well, this isn't so much of a PHP v Perl issue as a general web issue, but this is the first forum that it's relevant to at all since I thought of it, so I'll post it here.

I've recently been learning mod_perl, and working at moving my mindset over to it. It's not difficult, so much as a drastic mental switch. I've always avoided PHP, ASP, Coldfusion, Embperl, and other solutions of those types. I recently discovered Text::Template, and I love it. What's the difference? Dependence on the webserver.

With CGI Perl and Text::Template, I have command line scripts that are optimized to work with HTML browsers, but that function and are accessable without them.

When you convert to mod_perl, your documents cease to be apps, and the webserver stops being a document server, and instead becomes (in the words of merlyn), a programmable app.

Since I tend to prefer to keep things low level and accessable (ASCII forever!), this is a bit of a drastic switch. So when looking at PHP and Perl, think about how you want to view your documents.

Replies are listed 'Best First'.
Having Perl scripts work with and without a web browser
by princepawn (Parson) on Oct 13, 2000 at 16:56 UTC
    swiftone said:

    With CGI Perl and Text::Template, I have command line scripts that are optimized to work with HTML browsers, but that function and are accessable without them.

    Can you provide us with some samples of documents you have that work (seamlessly?) for both web service and command-line use?

    On this topic, Tom Christiansen floated a paper across Usenet awhile back that you should try to get if possible, named "GUIs Considered Harmful". In it, he states that an application should be useable from programs, the command line and the GUI.

      Can you provide us with some samples of documents you have that work (seamlessly?) for both web service and command-line use?

      I never claimed seamlessly :) What I meant was that any CGI script using CGI.pm should be able to be run from the commandline. For large sites, I currently use Text::Template to import/interpret templates (much like HTML::Template, etc), but I write the resulting HTML to flat files that the webserver serves. (even mod_perl has problems hitting the speed of flat HTML). With flat files holding content, I can manipulate the pages with scripts and other *nix tools such as grep, ispell, etc.

      Of course, this prevents me from having truly user-specific dynamic pages, so I write any of those with CGI perl scripts. When those scripts become large portions of the site, mod_perl is clearly a better solution. But it's a different mindset.

      Tom Christiansen floated a paper across Usenet awhile back that you should try to get if possible, named "GUIs Considered Harmful".

      I'll look for it, thanks

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2024-04-25 13:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found