Subject: Running a perl script thru a perl script

Hello,

I have built a script that has 2 environment variables passed to it and it
will take that data and return a value. This script works fine, but there
are many possibilites that can be passed to it. I want to build a test case
of sorts to pass to this script. In 'meta-code' this is what I would like to
do:

@from_numbers = qw( "6364421234", "6364421234", "3143221234", "3143221234"
);
@to_numbers = qw( "4225678", "6364425678", "3212222", "3143212222");

while (@from_numbers) {

set environment variable to from_number
set additional variable to to_number
run script

}

My main question: Is there a better way to run the other perl script other
than running an exec()? I am trying to keep processor usage down to a
minimum and I know that the exec() function opens up a shell (which takes
both time, memory, and processor). I dont know if perl has a 'better' way to
handle running another perl script.

A quick explanation of the script that I want to run within this script: The
script will take a phone 'from phone number' and a 'to phone number' and
return a value based on the 2 numbers. In trying to fix some things, I ended
up breaking others. In order to test this manually I have to go in, edit the
file, then run the script and find the result. I know how to go about
writing the rest of my test case script, just need to know if there is a
better way to run the one script within the other, hopefully avoiding
exec().

Any help is appreciated and if more info is needed, let me know and I will
supply it.


########

Not sure I understand your complete requirement but I use a "BEGIN" block to
read a file and set the email address I wish to send a message as the email
address can change and it depending on if I am test or production
environment... (I could have done the same thing without the BEGIN but I
already had the block for other things...)

So the script always sends email to $ENV{Admin} ... and BEGIN block always
reads a file at $ENV{HOME}/email.addrs, parses the file, and set various
$ENV values... 

You may wish to read about "Package Constructors and Destructors: BEGIN and
END"


Hope this gives you some ideas ...

jwm

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to