Laurent_R has asked for the wisdom of the Perl Monks concerning the following question:
I have a problem with using a module under VMS, but my problem is not necessarily due to VMS, but maybe to me not understanding fully the way the use lib qw/path_to_my_modules; and use mymodule; work.
Just to be clear, I have written at least two dozens other modules (mostly for various brands of Unix) and always succeeded to use them, but this is my first try under VMS and I am stuck.
I wrote a relatively complex application, which includes 3 large Perl programs, some DCL command files (equivalent of shell scripts under Unix) launching proprietary software applications for database access, etc. Just to give the overall context, in total about 30 different programs working together, but that's not my problem
For the three Perl programs that I wrote (which refactor and replace about 25 other existing programs), I also wrote a module containing some helper functions and some hashes of hashes describing the environment (IP addresses of the various platforms, batch queue name, and so on).
I originally wrote my programs and the common module all in my home directory (SYS$LOGIN under VMS), and got to the point where the whole thing is compiling and working exactly as expected.
The (simplified) syntax for the top pragmas was essentially as follows:
Notice that I have a say function defined in this module; on VMS, I am stuck Perl 5.8, so I wrote my own say sub because it is quite practical, this will be important below.use strict; use warnings; use VMS_UTILS qw (wait_for log_info check_valid_date (...) say); # ...
But I then needed to prepare for the production environment. Programs and modules should not be in the private home directory of a user, but in special directory called programs or PROGRAMS, VMS being case insensitive (it's not the real name, but let's say that's what it is), which is a logical name (i.e. an environment variable in Unix terms) pointing to a directory.
So, I moved the Perl programs and my module to the PROGRAMS directory and modified the Perl program as follows:
And I got the following message:use strict; use warnings; use lib qw/programs/; # also tried PROGRAMS, just in case, but equival +ent result use VMS_utils qw (... say); #using VMS_UTILS also does not change the +result
So, I thought, OK, may be Perl cannot resolve the programs symbol (it normally can without having to use the %ENV hash, because VMS does the transcription under the scene without Perl knowing, at least that's what I understand, but, maybe, in a use lib pragma it does not work), so I changed the use lib pragma to the content of the programs symbol.Can't locate VMS_utils.pm in @INC (@INC contains: programs perl_root:[ +lib.VM S_IA64.5_8_6] perl_root:[lib] perl_root:[lib.site_perl.VMS_IA64] perl_ +root:[lib. site_perl] /perl_root/lib/site_perl .) at ...
And that's where the result is really puzzling to me:
Now, I get a totally different type of errors:# use lib ('DISK$ECD:[DMC]'); # does not work use lib 'DISK$ECD/DMC/'; # does not work either use VMS_UTILS qw (...);
The compiler did not fail on loading the module, but failed on using the say subroutine defined in aforesaid module.perl -c programs:ALL_CRA_CHCOEX1262.pl String found where operator expected at ecd_programs:all_cra_chcoex126 +2.pl line 19, near "say "Environnement $plt incorrect !!"" (Do you need to predeclare say?) ... many other compile errors
Basically, to make things simple, what I do not understand is this:
- In one case, the program does not find the module, so that compilation fails. Fair enough.
- In the other case, it seems that the compiler was able to find the module, but apparently did not load it correctly. And everything works correctly if all the software components are in the home directory of the user.
Update: fixed a couple of formatting issues and typos. Also, sorry if this is long, I tried to explain as much as possible the context.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Solved - Using a module under VMS
by Laurent_R (Canon) on May 28, 2015 at 08:04 UTC | |
|
Re: Using a module under VMS
by Anonymous Monk on May 27, 2015 at 22:09 UTC | |
by Laurent_R (Canon) on May 28, 2015 at 07:34 UTC | |
by Anonymous Monk on May 28, 2015 at 09:17 UTC | |
by Anonymous Monk on May 28, 2015 at 09:21 UTC | |
by Laurent_R (Canon) on May 28, 2015 at 09:32 UTC |