Calling perl script from PHP

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • rahulthathoo

    #1

    Calling perl script from PHP

    Hi.

    I need to develop a web based application which uses php for the front
    end and statistical manipulations in perl - my question is - how do i
    call a perl script from php - i guess the answer is gonna be exec. I
    cant seem to understand how can i pass variables from the PHP script
    to the Perl script and vice versa using exec? Is there a better way to
    go about it?

    Rahul

  • Curtis

    #2
    Re: Calling perl script from PHP

    rahulthathoo wrote:
    Hi.
    >
    I need to develop a web based application which uses php for the front
    end and statistical manipulations in perl - my question is - how do i
    call a perl script from php - i guess the answer is gonna be exec. I
    cant seem to understand how can i pass variables from the PHP script
    to the Perl script and vice versa using exec? Is there a better way to
    go about it?
    >
    Rahul
    >
    The wonders of Google:


    --
    Curtis, http://dyersweb.com

    Comment

    • rahulthathoo

      #3
      Re: Calling perl script from PHP

      Apart from this, another question that I had was - once the perl
      script is done running - and has completed successfully, how do i know
      in the php script that this has happened - coz i need to do something
      the moment it(perl script) finished exection?

      Rahul




      Comment

      • rahulthathoo

        #4
        Re: Calling perl script from PHP

        On Feb 22, 9:42 pm, Curtis <zer0d...@veriz on.netwrote:
        rahulthathoo wrote:
        Hi.
        >
        I need to develop a web based application which uses php for the front
        end and statistical manipulations in perl - my question is - how do i
        call a perl script from php - i guess the answer is gonna be exec. I
        cant seem to understand how can i pass variables from the PHP script
        to the Perl script and vice versa using exec? Is there a better way to
        go about it?
        >
        Rahul
        >
        The wonders of Google:http://devzone.zend.com/node/view/id/1712
        >
        --
        Curtis,http://dyersweb.com

        Oh actually i saw this already, but this is not stable as they say. So
        I dont want to use this.

        Rahul

        Comment

        • Toby A Inkster

          #5
          Re: Calling perl script from PHP

          rahulthathoo wrote:
          I cant seem to understand how can i pass variables from the PHP script
          to the Perl script and vice versa using exec?
          You could store all your variables in one big array, serialize() the
          array, and then pass it to Perl as STDIN. In Perl, you can then use Scott
          Hurring's implementation[1] of unserialize() to retrieve the data.

          Passing data back, again, in Perl bundle the data up into a Perl hash,
          serialize() it using Hurring's module, and then print it to STDOUT. PHP
          reads the STDOUT and unserializes the data.

          Easy peasy.

          ____
          1. http://hurring.com/code/perl/serialize/

          --
          Toby A Inkster BSc (Hons) ARCS
          Contact Me ~ http://tobyinkster.co.uk/contact
          Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

          * = I'm getting there!

          Comment

          • Curtis

            #6
            Re: Calling perl script from PHP

            Toby A Inkster wrote:
            rahulthathoo wrote:
            >
            >I cant seem to understand how can i pass variables from the PHP script
            >to the Perl script and vice versa using exec?
            >
            You could store all your variables in one big array, serialize() the
            array, and then pass it to Perl as STDIN. In Perl, you can then use Scott
            Hurring's implementation[1] of unserialize() to retrieve the data.
            >
            Passing data back, again, in Perl bundle the data up into a Perl hash,
            serialize() it using Hurring's module, and then print it to STDOUT. PHP
            reads the STDOUT and unserializes the data.
            >
            Easy peasy.
            >
            ____
            1. http://hurring.com/code/perl/serialize/
            >
            Ah, that's very cool. That's a very clever way to communicate data. :)

            --
            Curtis, http://dyersweb.com

            Comment

            Working...