Re: calling one perl script from another

[email protected] ("Martin J. Evans")
Newsgroups perl.dbi.users
Organization Easysoft Limited
Message-ID <[email protected]>
Sumit Sharma wrote:
> Hello,
> I am trying to invoke one perl script from another. The called perl
> sript name is build.pl and is defined as below..
> build.pl
> **********
> main();
> sub main
> {
>   my $retval = check();
>   print $retval;
>   return $retval;
> }
> check() is a subroutine that returns either a zero or 1 based on whether
> a file exists or not. The print $retval correctly prints the result.
> Now, the calling perl script is build1.pl which invokes build.pl in the
> following way...
> build1.pl
> ***********
> main();
> sub main
> {
>   print "Calling build.pl\n";
>   my $result = system("build.pl");
>   print "build.pl returned $result, $?\n";
> }
> In build1.pl, the output shows up as build.pl returned 0, 0. I
> understand the second variable is zero since system command worked
> properly. But, why is first variable ($result) zero even though build.pl
> returns 1 from within its main subroutine.
> Is there any problem with above code I guess something is wrong in
> build.pl main subroutine, any suggestions..??
>  
> Thanks
>  
> 

This post has nothing to do with Perl DBI and is therefore off topic for
the dbi-users mailing list so please take your query somewhere else
(e.g., perlmonks or stackoverflow). Also, just because I answered one of
your posts on this list in the past, it does not mean I want to hear
about every problem you have so please don't mail me directly.

Martin
-- 
Martin J. Evans
Easysoft Limited
http://www.easysoft.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.