Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Problems getting Perl to find my package

by ted.byers (Monk)
on Jan 15, 2014 at 22:42 UTC ( #1070736=perlquestion: print w/replies, xml ) Need Help??
ted.byers has asked for the wisdom of the Perl Monks concerning the following question:

This is perl 5, version 18, subversion 1, running on OpenSuse 13.1

I have written multiple packages without a problem. Alas, I have a problem I have never encountered before. Here is the error message:

ted@linux-jp04:~/Work/Projects/Acuity> ./ Can't locate in @INC (you may need to install the acuity mod +ule) (@INC contains: home/ted/Work/Projects/Acuity/REJBlib /usr/lib/p +erl5/site_perl/5.18.1/x86_64-linux-thread-multi /usr/lib/perl5/site_p +erl/5.18.1 /usr/lib/perl5/vendor_perl/5.18.1/x86_64-linux-thread-mult +i /usr/lib/perl5/vendor_perl/5.18.1 /usr/lib/perl5/5.18.1/x86_64-linu +x-thread-multi /usr/lib/perl5/5.18.1 /usr/lib/perl5/site_perl .) at . +/ line 13. BEGIN failed--compilation aborted at ./ line 13.

Obviously, the file so named is actually there:

ted@linux-jp04:~/Work/Projects/Acuity> ls ./REJBlib total 32 drwxr-xr-x 2 ted users 4096 Jan 15 17:17 ./ drwxr-xr-x 3 ted users 4096 Jan 15 17:17 ../ -rwxr-xr-x 1 ted users 8983 Jan 15 17:17* -rwxr-xr-x 1 ted users 8983 Jan 15 16:58* ted@linux-jp04:~/Work/Projects/Acuity>

While I am not sure my code is the problem, here are the first few lines of code in my script:

#!/usr/bin/perl -d:NYTProf use warnings; use strict; use DateTime; use IO::All; use DateTime; use Math::Random::MT::Auto qw(rand irand); use lib 'home/ted/Work/Projects/Acuity/REJBlib'; use acuity; $| = 1;

And here are the first few lines of my package:

package acuity; use strict; use Exporter; use Carp; use Digest::MD5 qw(md5 md5_hex md5_base64); use DateTime; use Log::Log4perl qw(:easy get_logger); use LWP::UserAgent; use LWP::Protocol::https; use HTTP::Request; use HTTP::Request::Common; use HTTP::Response; use HTTP::Status; use Encode qw(decode encode); use JSON; use vars qw ($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); $VERSION = 1.00; @ISA = qw (Exporter); @EXPORT = (); @EXPORT_OK = qw(check_risk update_risk_data); %EXPORT_TAGS = (All => [qw(&check_risk &update_risk_data)]); my $class_data = {

And the last line in the package file is '1;'

So, it is clear from the error message that the 'use lib' statement had the desired effect, and that the package file exists in the directory specified. So, why is Perl not finding my package?

Any insights would be appreciated.



Replies are listed 'Best First'.
Re: Problems getting Perl to find my package
by VinsWorldcom (Parson) on Jan 15, 2014 at 22:58 UTC

    Should your 'use lib' line actually read:

    use lib '/home/ted/Work/Projects/Acuity/REJBlib'; ^ _________|

    You've omitted the leading slash for root directory.


      That was it. proof I am going blind in my old age.

      Thanks again


Re: Problems getting Perl to find my package
by tangent (Vicar) on Jan 15, 2014 at 22:55 UTC
    I don't use linux but your directory listing shows* and* but I would think you need (i.e. without the astersik and tilde) edit: oh, I see * means that the file is executable, and ~ a backup

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1070736]
Approved by toolic
[Corion]: Meh. I'm reviving some old code, and it seems it used a module DBIx::Loader, but it doesn't exist on CPAN, and I can't even remember writing such a module... Maybe parts of it live on in DBIx::RunSQL, but not the parts I need right now :)

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2018-06-24 08:22 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (126 votes). Check out past polls.