perl and php, horses for courses?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
hi all,

I have been blessed with the task of writing a web based database
representing the state of our globally installed isam databases.

there are basically four steps in setting this up:

1) schedule isam file reports to run at all remote sites. this
generates a text file describing the current state of tables (files) in
the database.

2) schedule an ftp job to pick up these text reports and dump them on a
central server

3) parse the reports and write the information to a mysql database

4) front end web based gui. make the information available (reports,
alerts, etc.)

Our company wants to use PHP for the front end GUI. Not having had much
experience with PHP it seems to me that the way to do the above would
be to do steps 1, 2 and 3 with Shell / Perl scripting (Perl being
designed for text file manipulation) and then to use PHP to provide the

Anyone's thoughts and / or input on this matter would be much


eddiec :-)

Re: perl and php, horses for courses?

pc wrote:

Quoted text here. Click to load it

Steps #1 and #2 could be simplified (and conserve bandwidth if that's
important) by using rsync on the remote sites.  Not sure what OS your
remote sites are using but I'm pretty sure rsync is available for Windows.  
Generate an MD5 for the file and send that to database feeder too.  That
way it can check to see if the file it's about to load is valid/complete.

Step #3 could be done in PHP, but if you're more comfortable with Perl, then
knock yourself out.  Populating a database is one of the jobs that seems to
lend itself to Perl/Python.  Additionally, you could daemonize the
process/script so it detects when steps #1/2 have changed or added files
that need pumping into the database.

Decide on whether you want a fundamental push or pull model.  Personally, in
these situations, I go for a push model:  let the database populating
functions sit and wait for the remote sites to feed it data.  This absolves
the db-feed-process of dealing with things like incomplete file loads or
bad network connections etc and makes it all a lot more reliable.  Make the
remote sites do some basic validation like checking the whole file was
uploaded (rsync return codes), sending an MD5 sum for the feeder to verify
against, that sort of thing.

Have fun!

A musician, an artist, an architect:
        the man or woman who is not one of these is not a Christian.
                -- William Blake

Re: perl and php, horses for courses?

On Thu, 05 Jan 2006 14:19:26 -0800, pc wrote:

Quoted text here. Click to load it

PHP can do pretty much anything that Perl can. OK, for some capabilities,
like reading/writing Excel spreadsheets and LWP, I would still go to Perl,
but text file manipulation can be done perfectly well with PHP.


Re: perl and php, horses for courses?

pc wrote:
Quoted text here. Click to load it
You can write background jobs and shell scripts in PHP. They run from  
the command line using PHP-CLI.  Just type "php myscript.php" from your  

I'm in the process of converting a bunch of Perl, .sh, and .vbs/.wsf  
programs I had written awhile back to PHP, just so all my code is  
standardized to one language and there is much less need for third-party  
extensions/modules.  (And, because I'm not good in Perl or bash, and  
their documentation can not compare to PHP docs.)  Try writing some text  
manipulation programs in PHP and you will be pleasantly surprised.

Site Timeline