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

Hi, I have a set of perl modules and scripts which perform data analysis. These are originally written by the author to be executed from the command line...each script needs certain parameters to work....is there a way for me to get the output using CGI....how should i pass the parameters??? And also some modules are not on my server so i copied them from CPAN into my home directory....actually i am a newbie hence i didn't know what makefile.pl etc mean...i just copied the .pm files by creating the directories...am i right in doing this or shud i install using the makefile.pl script only....please advise... rgds, chris

Replies are listed 'Best First'.
Re: Command line confusing me
by Zaxo (Archbishop) on Aug 26, 2003 at 09:19 UTC

    You have some chance of getting it right that way, but it would be better to install properly in some place like ~you/lib/perl5. The formula is,

    PREFIX=~/lib/perl5 perl Makefile.PL make make test make install
    Read the README files.

    Set PERL5LIB in your environment to your installation directory and everything should work.

    After Compline,
    Zaxo

Re: Command line confusing me
by benn (Vicar) on Aug 26, 2003 at 09:53 UTC
    Once you've installed the modules using Zaxo's advice, there are a couple of ways to interface to your data analysis scripts.

    The simplest would be to externally call them from within your program, using backticks or similar - something like this...

    my $munged_data = `analysis_program $data`;
    Alternatively, you could look into including the scripts in your source. Any modules should be easily importable with the 'use' statement, and it should be a simple task to replace command line parameters with passed-in parameters...something like this...
    #Old Code my $data = $ARGV[0]; do_stuff($data); #New Code package Munger; sub munge_data { my $data = shift(); do_stuff($data); } 1;
    HTH
    Ben.