Hi Laura,

you can use

require '../../myperlscript.pl';

However I would advise you go down the .pm route.
changing a .pl file into a .pm module isn't too big a hassle - simply ensure
your script is well structured using subroutines  then write a parent .pl
script to use that module and call each subroutine.

If you don't have much object oriented experience, this might take a while,
and using the above require method should work fine.

Regards

Marty

p.s. you should probably do this


my $perlscript='../../myperlscript.pl';
eval {
        require $myperlscript;
    };
if ($@)
{
      print STDERR "Script failed $myperlscript - $@\n";
}
else
{    print STDERR "Script successful\n";
}

Inside each of you perl test scripts you should use die statements :-

die "something went wrong, I've broken and died a horrible and squidgy
death";

Then when you run the require and the script dies, your main programme will
continue, and if ($@) then you know something has gone wrong with that
script. If a test fails, as opposed to passes, as it may do, it is a
different condition than the one that occurs if something nuexpected happens
within your code and it dies (either a perl runtime error or by your use of
die).

N.B. $@ will contain the error string of the original die message from your
script.




----- Original Message -----
From: "Laura Meli" <[EMAIL PROTECTED]>
To: "Perl-Win32-Users" <[EMAIL PROTECTED]>
Sent: Monday, November 11, 2002 1:41 PM
Subject: Newbie Question


> Hi everyone,
>
> I am just starting out to use perl to write my test scripts.  I was
> wondering if there was a way to call one perl program from another.  I
know
> that if I have a .pm module then I call it by the use function.  How about
a
> .pl file?  I want be able to choose which tests I run each time I execute
my
> perl script.  My plan was to create a separate perl script for each test
> suite then have one main perl script which calls the scripts I want to
> execute.
>
> Thanks in advance for your help.  The emails I receive from this group
have
> been really helpful.
>
> Laura
>
> _______________________________________________
> Perl-Win32-Users mailing list
> [EMAIL PROTECTED]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to