943,516 Members | Top Members by Rank

Ad:
  • Perl Discussion Thread
  • Unsolved
  • Views: 1916
  • Perl RSS
Aug 12th, 2009
-1

Calling a perlscript within a another script in a loop

Expand Post »
Hey Guys,

Have u any Idea how to call a perl script within my main script in a loop.
I used system and exec both, but it seems to be not working. I want the second calling of the script shouldn't depend on the first calling.... all should run independently............
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Prakash_8111 is offline Offline
21 posts
since Jun 2009
Aug 13th, 2009
0

Re: Calling a perlscript within a another script in a loop

you can try this: open the file, slurp it all in at once and use eval to execute the code.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
wickedxter is offline Offline
20 posts
since Jul 2009
Aug 14th, 2009
0

Re: Calling a perlscript within a another script in a loop

Calling another perl script in a loop should not be difficult but the last part of your question makes no sense to me.

Quote ...
I want the second calling of the script shouldn't depend on the first calling.... all should run independently............
Reputation Points: 246
Solved Threads: 67
Practically a Posting Shark
KevinADC is offline Offline
898 posts
since Mar 2006
Aug 14th, 2009
0

Re: Calling a perlscript within a another script in a loop

I am calling the script as exec(called_script.pl, arg1), its calling first time , second execution is not going, it is killing the main process. My second question refers all the time loop increases it should run another instance of the script. Ok can u just tell how to call the script in a loop. Thanks in advance
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Prakash_8111 is offline Offline
21 posts
since Jun 2009
Aug 14th, 2009
0

Re: Calling a perlscript within a another script in a loop

I guess you didn't read what exec() does.

Quote ...
The exec function executes a system command and never returns-- use system instead of exec if you want it to return
http://perldoc.perl.org/functions/exec.html

As they say on forums: Read the manual

If you want to run multiple instances of a perl program I think you will want to use threads. Not something I have experience with though:

http://search.cpan.org/~jdhedden/thr....74/threads.pm
Last edited by KevinADC; Aug 14th, 2009 at 1:43 pm.
Reputation Points: 246
Solved Threads: 67
Practically a Posting Shark
KevinADC is offline Offline
898 posts
since Mar 2006
Aug 17th, 2009
0

Re: Calling a perlscript within a another script in a loop

I know i've used print `command`; as well with varied success.
Reputation Points: 11
Solved Threads: 5
Junior Poster in Training
onaclov2000 is offline Offline
57 posts
since Jun 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Perl Forum Timeline: multiple sorts in same file question
Next Thread in Perl Forum Timeline: Perl running as Windows service





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC