Results 1 to 3 of 3

Thread: Need Perl script to execute from another.

  1. #1
    Join Date
    May 2008
    Posts
    69

    Need Perl script to execute from another.

    Hi,

    I am new with PERL programming.
    I have a question. Is it possible to call a Perl script from an another script. The problem is how to get a response from the script?

    Any help will be appreciated.

  2. #2
    Join Date
    Jan 2009
    Posts
    43

    Re: Need Perl script to execute from another.

    This will call a new perl process, and may be more expensive on the
    Code:
    system. On the other hand I can do
    Code:
    But How do I get the response of the script.
    Probably the dimpliest way is to make called script a module and run it
    using either 'use' or 'require'.
    If you care about speed, consider using do 'filename.pl', which will avoid firing up a new Perl interpreter.

  3. #3
    Join Date
    Jan 2009
    Posts
    40

    Re: Need Perl script to execute from another.

    I think you can do the following;
    1. backticks: $retVal = `perl somePerlScript.pl `;
    2. system() call
    3. eval
    The eval can be accomplished by slurping the other file into a string (or a list of strings), then 'eval'ing the strings
    Code:
    #!/usr/bin/perl
    open PERLFILE, "<somePerlScript.pl";
    undef $/;   # this allows me to slurp the file, ignoring newlines
    my $program = <PERLFILE>;
    eval $program;
    4. do:
    Code:
    do 'somePerlScript.pl'
    For more discussion.

Similar Threads

  1. How to run Perl script on Mozilla Firefox?
    By Grayson in forum Software Development
    Replies: 5
    Last Post: 02-11-2011, 02:35 PM
  2. Firefox problem with perl script
    By Gajendra1 in forum Software Development
    Replies: 6
    Last Post: 09-09-2010, 04:44 PM
  3. How to call perl script from Python?
    By Jhonwho in forum Software Development
    Replies: 3
    Last Post: 23-07-2009, 09:59 PM
  4. Is it possible to execute Perl script within another script?
    By RasMus in forum Software Development
    Replies: 2
    Last Post: 21-07-2009, 10:57 PM
  5. Title of a Perl CGI script
    By !const in forum Software Development
    Replies: 2
    Last Post: 26-03-2009, 11:43 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,487,976.51669 seconds with 17 queries