Re: Running perl from perl?

2006-05-23 Thread Sumo Wrestler (or just ate too much)

siegfried wrote:

How do I run a perl program from a perl program? I could use the back quote
(grave) I suppose. I could also use "system". Is there  a better way that
does not create an additional process?
[...]


If I were you I'd go ahead an create additional processes, but the
threads module seems to allow for what you're trying to do.

However, once your program has gotten memory from the O/S, there's no
portable way for it to return that memory to the O/S. If you use a
separate process, when the process exits, it's memory is returned to the
O/S.





--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: Running perl from perl?

2006-05-23 Thread Mr. Shawn H. Corey
On Tue, 2006-23-05 at 15:00 -0600, siegfried wrote:
> How do I run a perl program from a perl program? I could use the back quote
> (grave) I suppose. I could also use "system". Is there  a better way that
> does not create an additional process?
> 
> I have six perl programs running once a day (via cygwin cron). I would like
> to have a single cron job running once an hour that checks the database for
> the oldest task and, if it is more than 24 hours old, run it.
> 
> I could also write one monster program that combines all six programs. That
> is a lot of superfluous "use" statements if I'm only going to be running one
> of the six at a time.
> 
> Perhaps I could have a "switch" statement to only "require" those modules
> that have been determined to be necessary for the oldest task. Is this the
> best way?

You could use AutoLoader, see `perldoc AutoLoader`. AutoLoader only
loads subroutines when there are called. AutoLoader is shipped with
Perl.


-- 
__END__

Just my 0.0002 million dollars worth,
   --- Shawn

"For the things we have to learn before we can do them, we learn by doing them."
  Aristotle

* Perl tutorials at http://perlmonks.org/?node=Tutorials
* A searchable perldoc is at http://perldoc.perl.org/



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: Running perl from perl?

2006-05-23 Thread Anthony Ettinger

On 5/23/06, siegfried <[EMAIL PROTECTED]> wrote:


How do I run a perl program from a perl program? I could use the back quote
(grave) I suppose. I could also use "system". Is there  a better way that
does not create an additional process?

I have six perl programs running once a day (via cygwin cron). I would like
to have a single cron job running once an hour that checks the database for
the oldest task and, if it is more than 24 hours old, run it.

I could also write one monster program that combines all six programs. That
is a lot of superfluous "use" statements if I'm only going to be running one
of the six at a time.

Perhaps I could have a "switch" statement to only "require" those modules
that have been determined to be necessary for the oldest task. Is this the
best way?



if it's a standalone script you want to run, use system() or `` if you
need to capture output.

if it's just a bunch of routines you want to execute, you could put
the main routine in the script into a  sub called from within your
wrapper script, including the library script with
require('/path/to/script.pl'); at the top. (no need for shebang line
here).

require('/path/to/foo.pl');

foo(); # call main::foo sub routine defined inside foo.pl




--
Anthony Ettinger
Signature: http://chovy.dyndns.org/hcard.html

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Running perl from perl?

2006-05-23 Thread siegfried

How do I run a perl program from a perl program? I could use the back quote
(grave) I suppose. I could also use "system". Is there  a better way that
does not create an additional process?

I have six perl programs running once a day (via cygwin cron). I would like
to have a single cron job running once an hour that checks the database for
the oldest task and, if it is more than 24 hours old, run it.

I could also write one monster program that combines all six programs. That
is a lot of superfluous "use" statements if I'm only going to be running one
of the six at a time.

Perhaps I could have a "switch" statement to only "require" those modules
that have been determined to be necessary for the oldest task. Is this the
best way?

Thanks,
Siegfried 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]