Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Perl Module Question

Posted on 2014-02-05
Medium Priority
Last Modified: 2014-02-05
I am trying to use a module in my perl script. I do not have access to the directories that are in perl's search path however. How do I include a perl module in my script when I don't have permission to put it in the path that perl searches?

I would like to use:
use BlahThing;

where has all of my variables. My module is in the same directory as my script.
Question by:stakor
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 28

Accepted Solution

FishMonger earned 2000 total points
ID: 39835621

use strict;
use warnings;
use lib '.';  # not normally needed if the module is in the same dir as the script
use BlahThing;

Open in new window

See: lib - manipulate @INC at compile time

Author Comment

ID: 39837126
When I attempt to do this, I get the following:

Global symbol "$work_tar_dir" requires explicit package name at line 15.
Compilation failed in require at /home/username/ line 14.
BEGIN failed--compilation aborted at /home/username/ line 14.

The first part of the script is below (Minus comments):



use strict;
use warnings;

use lib '.';
use BlahThing;
use File::Basename;

chdir($drop_dir) or die "Cant chdir to $drop_dir $!";
LVL 28

Expert Comment

ID: 39837170
Is $drop_dir defined in BlahThing?  If so, did you export it?

Is BlahThing defined as a module or is it simply a library file?

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question