Hi:
I would like to call a perl script(B.pl) within another perl script(A.pl).
Should I use the following approach or something else?
A.pl
-----
my $cmd = "perl B.pl"
system($cmd);
Please let me know.
Thanks.
QUOTE |
I guess it partly depends on what you are trying to accomplish. Why are you calling a second script? -----Original Message----- From: Nishi Prafull [mailto:[Email Removed]] Sent: Thursday, March 03, 2005 3:47 PM To: [Email Removed] Subject: call a perl script within another perl script Hi: I would like to call a perl script(B.pl) within another perl script(A.pl). Should I use the following approach or something else? |
QUOTE |
Hi: Apparently I noticed that when I put both the commands I need to run in one script using the system call, the second command does not get executed ( I cannot figure out the cause). They would have to be two separate calls. I used to start 10 to 15 processes at one time using a Perl script to get my setup the way I wanted it. Then I knew exactly where they were and the order they were in. |
QUOTE |
Each of the commands are making out calls to software installed on the machine to perform specific tasks. Do I have to do anything else in this regard? Thanks. On Thu, 3 Mar 2005 15:50:16 -0800, Tim Johnson <[Email Removed] wrote: I guess it partly depends on what you are trying to accomplish. Why are you calling a second script? -----Original Message----- From: Nishi Prafull [mailto:[Email Removed]] Sent: Thursday, March 03, 2005 3:47 PM To: [Email Removed] Subject: call a perl script within another perl script Hi: I would like to call a perl script(B.pl) within another perl script(A.pl). Should I use the following approach or something else? |
QUOTE |
Nishi Prafull wrote: Hi: Apparently I noticed that when I put both the commands I need to run in one script using the system call, the second command does not get executed ( I cannot figure out the cause). They would have to be two separate calls. I used to start 10 to 15 processes at one time using a Perl script to get my setup the way I wanted it. Then I knew exactly where they were and the order they were in. So you only need to do; my $MyStatus1 = system('script1.pl'); # make sure you qualify the script as much as necessary and not rely on # paths. # should check that status was a success which i believe is backwards from what Perl defines as success(0: good, <> # 0:error) my $MyStatus2 = system('script2.pl'); # second one to execute. Wags ;) Each of the commands are making out calls to software installed on the machine to perform specific tasks. Do I have to do anything else in this regard? Thanks. On Thu, 3 Mar 2005 15:50:16 -0800, Tim Johnson <[Email Removed] wrote: I guess it partly depends on what you are trying to accomplish. Why are you calling a second script? -----Original Message----- From: Nishi Prafull [mailto:[Email Removed]] Sent: Thursday, March 03, 2005 3:47 PM To: [Email Removed] Subject: call a perl script within another perl script Hi: I would like to call a perl script(B.pl) within another perl script(A.pl). Should I use the following approach or something else? ******************************************************* This message contains information that is confidential and proprietary to FedEx Freight or its affiliates. It is intended only for the recipient named and for the express purpose(s) described therein. Any other use is prohibited. ******************************************************* |
QUOTE |
Apparently, the first command spawns a new shell when it is executed and the control is never returned back and hence i cannot get the second command to get executed. So I am trying to evaluate the -exec option. Thanks. On Thu, 3 Mar 2005 16:14:30 -0800, Wagner, David --- Senior Programmer Analyst --- WGO <[Email Removed]> wrote: Nishi Prafull wrote: Hi: Apparently I noticed that when I put both the commands I need to run in one script using the system call, the second command does not get executed ( I cannot figure out the cause). They would have to be two separate calls. I used to start 10 to 15 processes at one time using a Perl script to get my setup the way I wanted it. Then I knew exactly where they were and the order they were in. So you only need to do; my $MyStatus1 = system('script1.pl'); # make sure you qualify the script as much as necessary and not rely on # paths. # should check that status was a success which i believe is backwards from what Perl defines as success(0: good, <> # 0:error) my $MyStatus2 = system('script2.pl'); # second one to execute. Wags ;) Each of the commands are making out calls to software installed on the machine to perform specific tasks. Do I have to do anything else in this regard? Thanks. On Thu, 3 Mar 2005 15:50:16 -0800, Tim Johnson <[Email Removed] wrote: I guess it partly depends on what you are trying to accomplish. Why are you calling a second script? -----Original Message----- From: Nishi Prafull [mailto:[Email Removed]] Sent: Thursday, March 03, 2005 3:47 PM To: [Email Removed] Subject: call a perl script within another perl script Hi: I would like to call a perl script(B.pl) within another perl script(A.pl). Should I use the following approach or something else? ******************************************************* This message contains information that is confidential and proprietary to FedEx Freight or its affiliates. It is intended only for the recipient named and for the express purpose(s) described therein. Any other use is prohibited. ******************************************************* -- To unsubscribe, e-mail: [Email Removed] For additional commands, e-mail: [Email Removed] <http://learn.perl.org/> <http://learn.perl.org/first-response |
QUOTE |
I would like to call a perl script(B.pl) within another perl script (A.pl). Should I use the following approach or something else? A.pl ----- my $cmd = "perl B.pl" system($cmd); Please let me know. |