Solved

Perl Module Question

Posted on 2014-02-05
3
257 Views
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 BlahThing.pm has all of my variables. My BlahThing.pm module is in the same directory as my script.
0
Comment
Question by:stakor
  • 2
3 Comments
 
LVL 28

Accepted Solution

by:
FishMonger earned 500 total points
ID: 39835621
#!/usr/bin/perl

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
0
 

Author Comment

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

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

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

#!/usr/bin/perl

#
#
#
#
#

use strict;
use warnings;

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

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

Expert Comment

by:FishMonger
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?
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

707 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now