On 7/20/2014 2:52 PM, John Dite wrote:


1.) A failed lookup in %ENV sets errno / vaxc$errno in our getenv
implementation (specifically Perl_vmstrenv in [.vms]vms.c). This is
normal and as it should be.

2.) die() (specifically Perl_my_failure_exit in perl.c) retrieves the
most recent value of vaxc$errno and uses it as the VMS exit status. This
is also normal behaviour.

In the first example vaxc$errno was set to %RMS-E-DNF but $status is
%SYSTEM-F-ABORT.

That is the default behavior of Perl because older programs expect this behavior per documentation, all perl error exit codes were translated to 0x2c.

http://perldoc.perl.org/perlvms.html

If you define PERL_VMS_POSIX_EXIT or DECC$FILENAME_UNIX_REPORT, it is supposed to behave the way that you would normally expect.

From a quick test on Encompasserve with PERL 5.18, that feature does not appear to be working.

When that feature is working from DCL scripts or Bash you can recover the original Unix error code unless it is a VMS specific error.

I do not know why the PERL_VMS_POSIX_EXIT feature does not appear to be working, I have not built/tested perl on VMS for a few years.

In the second example, a usual, aka C, getenv() doesn't set errno. Why
setting errno to EINVAL and vaxc$errno to NOLOGNAM "is normal and as it
should be" for the VMS implementation is not obvious to me.

Perl does not use getenv() for environment variables by default. It uses VMS system services to look up the current value.

Anyway I'm off on vacation for the next 2 weeks, so don't expect any
quick responses.

Regards,
-John
wb8tyw@qsl.network

Reply via email to