Thank you for your answer, Anonymous Monk, but yes, I have figured out this caveat on the lib pragma, which is why I tried both these syntaxes:
# use lib ('DISK$ECD:[DMC]'); # does not work
use lib 'DISK$ECD/DMC/'; # does not work either
Although the origin of my problem really seems to have something to do with VMS specificities, my question is really more general and not VMS specific: in one case, Perl does not find the module and compilation fails on the use VMS_utils , which is what I would expect. But once I tried to fix that by changing the use lib qw/.../ clause, I no longer have an error on loading the module, so I would assume Perl succeeded to load it, but compilation fails on using the subroutines (e.g. the say function) defined in this module.
So my more general question is: are there some conditions under which Perl does not fail on the use statement loading a module but still does not apparently load the subroutines defined in the module. Knowing that my module is apparently correct, since everything works correctly when both the programs and the module are in the same directory.
Please also note that I have also tried, among many other things, to copy my module into one of the @INC paths, but I still get the compilation error on the use of subroutines defined in the module. This is really puzzling my mind.
| [reply] [d/l] [select] |
perl -Ivmsdirhere -MModulename -e 1
If you can't get that working, try require 'vmsdirhere/Modulename.pm';
An error should pop, and you should be able to figure it out ... do you have use feature qw/ say /; or equivalent (if thats the issue)?
| [reply] [d/l] [select] |
hah, never mind, just saw Re: Solved - Using a module under VMS
case insensitive filesystems and case sensitive programming languages ... strict.pm/warnings.pm checks for this ... but they're important
# Verify that we're called correctly so that strictures will work.
unless ( __FILE__ =~ /(^|[\/\\])\Q${\__PACKAGE__}\E\.pmc?$/ ) {
# Can't use Carp, since Carp uses us!
my (undef, $f, $l) = caller;
die("Incorrect use of pragma '${\__PACKAGE__}' at $f line $l.\n");
}
| [reply] [d/l] |
Thank you for your very interesting suggestion, other Anonymous Monk, but as I said below, I succeeded to make it work. As noted below, while trying to solve the first issue (the path to the dir), I made the mistake of changing the module name to all-uppercase in my use module; statement, so that, in the end, once having solve the path problem, the module would load correctly, but the package would no longer be recognized. I have now solved it by putting it back to use VMS_utils;.
As for the say, I am stuck on VMS with Perl 5.8, so that feature does not exists. I just wrote my own version of say in the module. The fact that it did not recognized say indicated in fact that the package was not being recognized.
Thanks anyway for your help.
Update: Ooops, I had not seen your second answer when I wrote the above, or probably it was not yet there when I loaded the page and decided to answer.
| [reply] [d/l] [select] |