Ed James, wrote:
> My question was about non-begin block name spaces, where the "require ..."
> evidently uses a separate name space:
>
> $ type vmsish_test.pl
> my $EXIT_SUCCESS;
> my $EXIT_BADPARAM;
> # BEGIN {
> if( $^O eq 'VMS') {
> require vmsish; vmsish::import( 'vmsish', 'exit', 'status');
> $EXIT_SUCCESS = 1; # ok
> $EXIT_BADPARAM = 20; # invalid parameter
> }
> else {
> $EXIT_SUCCESS = 0;
> $EXIT_BADPARAM = 1;
> }
> # }
> print "\$EXIT_SUCCESS = $EXIT_SUCCESS\n";
> print "\$EXIT_BADPARAM = $EXIT_BADPARAM\n";
> exit($EXIT_SUCCESS);
> __END__
> $ perl vmsish_test.pl[PERL]$ perl vmsish_test.pl
> $EXIT_SUCCESS = 1
> $EXIT_BADPARAM = 20
> %SYSTEM-F-ABORT, abort
> $ show symbol $status
> $STATUS == "%X0000002C"
In general if you are trying to do fancy C<use> or C<require> statements
then you should place them in BEGIN blocks. But I think there
may be a missunderstanding of the vmsish pragma so I'll ignore
the BEGIN block and try this instead:
my $EXIT_SUCCESS;
my $EXIT_BADPARAM;
if( $^O eq 'VMS') {
require vmsish; vmsish::import( 'vmsish', 'exit', 'status');
$EXIT_SUCCESS = 1; # ok
$EXIT_BADPARAM = 20; # invalid parameter
}
else {
$EXIT_SUCCESS = 0;
$EXIT_BADPARAM = 1;
}
print "\$EXIT_SUCCESS = $EXIT_SUCCESS\n";
print "\$EXIT_BADPARAM = $EXIT_BADPARAM\n";
#exit($EXIT_SUCCESS);
exit(0);
__END__
I obtain:
$ perl "-Mstrict" -w vmsish_test.pl
$EXIT_SUCCESS = 1
$EXIT_BADPARAM = 20
$ sho sym $status
$STATUS == "%X00000001"
Is that clear?
Peter Prymmer