D
doolittle
Hello,
I would like to exit from my perl module, transferring control to the
calling program. Can this be done directly from an arbitrary subroutine
in the module?
eg
progam.pl:
use mymodule;
my $errror = mymodule::doSomething();
if ($error) { print 'error' }
....
-------------
mymodule.pm:
sub doSomething { doOne() }
sub doOne {
my $error = 1;
if ($error) {
# code to return directly to program.pl
}
}
1
------------------
So what can i replace '# code to return directly to program.pl' with so
that progam.pl prints
error
?
Die and Croak are too drastic, as they stop perl, and I don't want to
return an error up from doOne because it gets called from all over
mymodule.pm, deep within the program.
Any suggestions? Is it time i learnt about fork?
Thanks
I would like to exit from my perl module, transferring control to the
calling program. Can this be done directly from an arbitrary subroutine
in the module?
eg
progam.pl:
use mymodule;
my $errror = mymodule::doSomething();
if ($error) { print 'error' }
....
-------------
mymodule.pm:
sub doSomething { doOne() }
sub doOne {
my $error = 1;
if ($error) {
# code to return directly to program.pl
}
}
1
------------------
So what can i replace '# code to return directly to program.pl' with so
that progam.pl prints
error
?
Die and Croak are too drastic, as they stop perl, and I don't want to
return an error up from doOne because it gets called from all over
mymodule.pm, deep within the program.
Any suggestions? Is it time i learnt about fork?
Thanks