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

I have a perl script which I am using to generate some data. I want to process this data (as an input) through a program that is written using the Webware for Python Web application framework and the Rialto client-side Javascript widget library, to generate the results.

Does anyone know how I can call or run this program from within my perl script. I would appreciate any kind of help or pointers.

Thanks

  • Comment on how to run a python web application from within a perl script

Replies are listed 'Best First'.
Re: how to run a python web application from within a perl script
by BrowserUk (Patriarch) on Nov 19, 2009 at 20:13 UTC

    Use a piped open to feed the data to the python script:

    my @data = genData(); my $pid = open OUT, '-|', 'python theScript.py' or die; print OUT $_ for @data; close OUT; waitpid $pid, 0; ## The python script has finished.

    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
Re: how to run a python web application from within a perl script
by Fox (Pilgrim) on Nov 19, 2009 at 18:12 UTC
    run this program from within my perl script
    $output = qx(python path/to/script.py);

      You sort of forgot about the data, didn't you? The op said they were trying to send some data to a python program.

      op, how do those programs read data? From a file?

        op, how do those programs read data? From a file?

        That sounds like a great idea