sleddergirl has asked for the wisdom of the Perl Monks concerning the following question:

We are testing a new Linux server running RHEL7 and Perl5. My Perl program (code snippet below) dies on the 'use SSSourceOrg' line (code snippet also below). This is a home-grown module as is Syslog. The difference I found between Syslog and SSSourceOrg is that Syslog has 1 function and SSSourceOrg has multiple functions. The error is "Can't locate SSSourceOrg.pm in @INC (@INC contains: /usr/local/lib64/perl5...)". The module isn't and shouldn't be part of @INC and it does exist in my PERL5LIB path. I changed SSSourceOrg.pm so that it now has only 1 function and I changed the perl program so the use line is just 'use SSSourceOrg;' and the program gets by the line successfully and dies on the next line. I'm not a Perl developer so I'm hoping that someone else has run into this problem and can tell me how to fix it without changing all of our modules to be single-function.

test1.pl #!/usr/bin/perl use English; use POSIX qw( :stdlib_h strftime getcwd ); use Getopt::Std; use FileHandle; use strict vars; use File::Basename; eval "use CVSClient"; use Syslog; # homegrown version use SSSourceOrg qw( getLibExts getLibDirs ); use SSMail qw( send );
package SSSourceOrg; use strict; use POSIX qw( :stdlib_h ); use Cwd; use File::Basename; use English; use UserIO qw( getStrUntilMatch ); require Exporter; use vars qw( $VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); $VERSION = 1.01; @ISA = qw( Exporter ); @EXPORT = (); %EXPORT_TAGS = (); @EXPORT_OK = qw( getValidModule getSSROPath getSSEditPath getPaths getRefRoot getEditRoot getQARoot getCommittedLibRoot getLinkedDir getLibExts getLibDirs getLibRegex isCopybook isCobolProgram buildcobcpy ); my @libExts = qw( LIB UNQ PRC HVD WS IO ); #my @libDirs = qw( lio lib lci lga lhv lxf ); my $libRegex = "(\\." . join( "|\\.", @libExts ) . ")"; sub getLibExts(){ return( @libExts ); } 1;

Replies are listed 'Best First'.
Re: Problems with RHEL7 and multi-function modules
by hippo (Archbishop) on Feb 12, 2016 at 13:48 UTC
    The module isn't and shouldn't be part of @INC and it does exist in my PERL5LIB path.

    @INC should contain $PERL5LIB's contents anyway, if it doesn't then that is likely the source of your problem:

    $ export PERL5LIB=/foo:/bar $ perl -e 'print "@INC\n";' /foo /bar /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/per +l5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/sha +re/perl5 .
Re: Problems with RHEL7 and multi-function modules
by 2teez (Vicar) on Feb 12, 2016 at 21:12 UTC

    Try using lib like so:

    ... use lib 'path/to_pm_file'; use pm_file; ... # the rest is taken care of...

    If you tell me, I'll forget.
    If you show me, I'll remember.
    if you involve me, I'll understand.
    --- Author unknown to me

      Thank you for your help. This did get me by that issue. Now my program is complaining about something else which I suspect is a server setup problem so I have some more digging to do. But I do appreciate the help with this problem!