Issue in executing more than one perl script from Single perl script

Discussion in 'Perl Misc' started by nilesh.sonawane@gmail.com, Nov 1, 2007.

  1. Guest

    Hi,
    I am calling "1.pl" from "main.pl" file.
    using
    #main.pl
    system ("perl 1.pl");

    In this case it works fine.

    But when I am doing
    #main.pl
    system ("perl 1.pl");
    system ("perl 2.pl");

    then it doesn't executes "1.pl" properly.
    So I would like to know, is there any constraint for this? Do I need
    to take any precautions for this?

    Thanks,
     
    , Nov 1, 2007
    #1
    1. Advertising

  2. <> wrote:

    > But when I am doing
    > #main.pl
    > system ("perl 1.pl");
    > system ("perl 2.pl");
    >
    > then it doesn't executes "1.pl" properly.



    You need to provide some symptoms if you hope for a diagnosis.

    How do you know that it did not execute properly?

    What did you observe?

    Were any messages issued?

    ....


    --
    Tad McClellan
    email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
     
    Tad McClellan, Nov 1, 2007
    #2
    1. Advertising

  3. Guest

    On Nov 1, 2:52 am, wrote:
    > Hi,
    > I am calling "1.pl" from "main.pl" file.
    > using
    > #main.pl
    > system ("perl 1.pl");
    >
    > In this case it works fine.
    >
    > But when I am doing
    > #main.pl
    > system ("perl 1.pl");
    > system ("perl 2.pl");
    >
    > then it doesn't executes "1.pl" properly.
    > So I would like to know, is there any constraint for this? Do I need
    > to take any precautions for this?
    >
    > Thanks,


    Why are you using system() for this? AFAIK it forks a
    whole new process - a lot of overhead to go to.
    Isn't this what the "require" facility is for?

    FWIW

    Jim Lane
     
    , Nov 1, 2007
    #3
  4. Re: Issue in executing more than one perl script from Single perlscript

    wrote:
    > On Nov 1, 2:52 am, wrote:
    >> Hi,
    >> I am calling "1.pl" from "main.pl" file.
    >> using
    >> #main.pl
    >> system ("perl 1.pl");
    >>
    >> In this case it works fine.
    >>
    >> But when I am doing
    >> #main.pl
    >> system ("perl 1.pl");
    >> system ("perl 2.pl");
    >>
    >> then it doesn't executes "1.pl" properly.
    >> So I would like to know, is there any constraint for this? Do I need
    >> to take any precautions for this?
    >>
    >> Thanks,

    >
    > Why are you using system() for this? AFAIK it forks a
    > whole new process - a lot of overhead to go to.
    > Isn't this what the "require" facility is for?


    Using system, you start a completely new program which executes on its
    own, in its own context and e.g. is not required to be a Perl program at
    all.

    OTOH "require" will include the Perl program code into the current
    program code.

    --
    Mails please to josef dot moellers
    and I'm on gmx dot de.
     
    Josef Moellers, Nov 1, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sachin
    Replies:
    1
    Views:
    360
    Tjerk Wolterink
    Dec 1, 2005
  2. Merciadri Luca
    Replies:
    4
    Views:
    834
  3. Water Cooler v2
    Replies:
    2
    Views:
    488
    Water Cooler v2
    Apr 18, 2006
  4. Steven D'Aprano
    Replies:
    0
    Views:
    116
    Steven D'Aprano
    Dec 23, 2013
  5. Replies:
    3
    Views:
    98
    Gary Herron
    Dec 23, 2013
Loading...

Share This Page