![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| perl DBI/DBD Module -in cygwin | jambesh | Shell Programming and Scripting | 3 | 10-20-2007 02:38 PM |
| Can I use a Perl Module without installing it? | jjinno | Shell Programming and Scripting | 1 | 08-29-2007 02:55 PM |
| perl module question | convenientstore | Shell Programming and Scripting | 1 | 05-22-2007 08:25 PM |
| Replace Perl Module name in all Perl scripts | rahulrathod | Shell Programming and Scripting | 2 | 12-02-2005 01:00 AM |
| Writing perl module | jo_aze | Shell Programming and Scripting | 4 | 08-06-2003 12:10 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Perl module question
Trying to get a better grip on perl module, I was testing out below script,
When I use "use Acme statement", it loads the module properly and it works. However, when I want to test out the ' use lib ' it comes up with below error message(looks like it is able to locate but cannot read or import back the function for whatever reason??). [root@myserver perl]# ./logtest2.module.pl Undefined subroutine &main: pen_log called at ./logtest2.module.pl line 23.Code:
#!/usr/bin/perl -w
use strict;
#
# Below use Acme works ; just uncomment it
#
#use Acme::Webserver::Logger;
#
# See if you can understand and do use lib
#
use lib '/usr/lib/perl5/site_perl/5.8.8/Acme/Webserver';
require Logger;
#require 'Logger.pl';
#use Logger;
# /usr/lib/perl5/5.8.5/Acme/Webserver
open_log("webserver.log");
write_log(1, "A basic message");
write_log(10, "A debugging message");
log_level(10);
write_log(10, "Another debugging message");
close_log();
usr/lib/perl5/site_perl/5.8.8/Acme/Webserver DB<1> print "@INC"; /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.7/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl/5.8.7 /usr/lib/perl5/site_perl/5.8.6 /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.7/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl/5.8.7 /usr/lib/perl5/vendor_perl/5.8.6 /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.8/i386-linux-thread-multi /usr/lib/perl5/5.8.8 |
|
||||
|
I am not sure about Perl 4, but considering Perl 5 was officially released more than 13 years ago, I see no reason to consider it anymore because many Perl 4 practices have been deprecated and pursuing them you are just asking for trouble.
Normally "require" should work. I'm not sure why you said it didn't work for you. The major difference between "require" and "use" is that "require" is a runtime instruction, while "use" is a compile-time instruction, so it is executed before the rest of the program. So, you will need to use "use lib" early in the program to adjust the @INC at compile time. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|