Hello first timer here posting~ Trying to get a better grip on perl module and,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();
I have both Logger.pm and Logger.pl(just in case) in 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-t +hread-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 /u +sr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-th +read-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/perl +5/vendor_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/vendor_per +l/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 .

In reply to try to understand use lib in module by convenientstore

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.