Perl: the Markov chain saw PerlMonks

Re^2: Module not included but present in %INC!

 on Jan 06, 2012 at 16:10 UTC ( #946618=note: print w/replies, xml ) Need Help??

Hello toolic,

This is the output after I added your lines to the file:
/usr/lib/perl5/site_perl/5.8.8/Date/Parse.pm$VAR1 = [ '/usr/local/nagios/libexec', '/usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi' +, '/usr/lib64/perl5/site_perl/5.8.7/x86_64-linux-thread-multi' +, '/usr/lib64/perl5/site_perl/5.8.6/x86_64-linux-thread-multi' +, '/usr/lib64/perl5/site_perl/5.8.5/x86_64-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/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-mult +i', '/usr/lib64/perl5/vendor_perl/5.8.7/x86_64-linux-thread-mult +i', '/usr/lib64/perl5/vendor_perl/5.8.6/x86_64-linux-thread-mult +i', '/usr/lib64/perl5/vendor_perl/5.8.5/x86_64-linux-thread-mult +i', '/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/lib64/perl5/5.8.8/x86_64-linux-thread-multi', '/usr/lib/perl5/5.8.8', '.' ]; [download] The error message I get is: Undefined subroutine &Dante::Correlation::CorrelationEngine::str2time +called at /usr/local/nagios/libexec/Dante/Correlation/CorrelationEngi +ne.pm line 644. [download] The only way to reduce the pm into minimum number of lines would be test.pl which I had written. Only difference is that I have another .pl script which includes CorrelationEngine.pm. Thanks for your help. Trupti Replies are listed 'Best First'. Re^3: Module not included but present in %INC! by Corion (Pope) on Jan 06, 2012 at 16:20 UTC Undefined subroutine &Dante::Correlation::CorrelationEngine::str2time +called at /usr/local/nagios/libexec/Dante/Correlation/CorrelationEngi +ne.pm line 644 [download] This means that the offending code lives in /usr/local/nagios/libexec/Dante/Correlation/CorrelationEngine.pm, and my guess is that the file in question does not load Date::Parse. Thanks for your reply Corion I reduced my pm file and wrote another .pl so as to reproduce the problem. Here they are: The test.pl file, which includes the .pm file: #!/usr/bin/perl use strict; use warnings; use Dante::Correlation::CorrelationEngine; my$correlationEngine = Dante::Correlation::CorrelationEngine->new(1);
$correlationEngine->testFunction(); exit; [download] The CorrelationEngine.pm file: # # Dante::Correlation::CorrelationEngine.pm - Implements top-level co +rrelation logic. # ########## use strict; use warnings; use Date::Parse; # There are a bunch of other .pm includes here, but they are modules f +or the project, not any other perl module # There are other functions here, not listed, of course sub testFunction { print str2time("2011-03-18 02:39:04") . "\n"; print str2time("1970-01-01 00:00:10") . "\n"; print str2time("2012-01-05 14:23:09") . "\n"; } # Must return 1 for the class to be compilable. 1; # End of Dante::Correlation::CorrelationEngine.pm [download] Executing test.pl results in following error: ./test2.pl Undefined subroutine &Dante::Correlation::CorrelationEngine::str2time +called at Dante/Correlation/CorrelationEngine.pm line 664. [download] So if the culprit is CorrelationEngine.pm, how can I make sure it loads Date::Parse? I'm at my wits end with this now; seems so simple, can't figure out why its not working. Please help! Trupti You presumably have the package Dante::Correlation::CorrelationEngine declaration after the use Date::Parse statement — in which case the functions (like str2time) will be exported into main::, not Dante::Correlation::CorrelationEngine. When I put the package statement in the appropriate place, and add a constructor, the code works fine for me. I modified test.pl and your .pm file. This works for me: $ find .
.
./test.pl
./Dante
./Dante/Correlation
./Dante/Correlation/CorrelationEngine.pm

$cat Dante/Correlation/CorrelationEngine.pm # # Dante::Correlation::CorrelationEngine.pm - Implements top-level co +rrelation logic. # ########## package Dante::Correlation::CorrelationEngine; use strict; use warnings; use Date::Parse; # There are a bunch of other .pm includes here, but they are modules f +or the project, not any other perl module # There are other functions here, not listed, of course sub testFunction { print str2time("2011-03-18 02:39:04") . "\n"; print str2time("1970-01-01 00:00:10") . "\n"; print str2time("2012-01-05 14:23:09") . "\n"; } # Must return 1 for the class to be compilable. 1; # End of Dante::Correlation::CorrelationEngine.pm$
$cat ./test.pl #!/usr/bin/env perl use warnings; use strict; use Dante::Correlation::CorrelationEngine; Dante::Correlation::CorrelationEngine::testFunction();$
 ./test.pl
1300430344
18010
1325791389
\$
[download]
Where is the package declaration?

Create A New User
Node Status?
node history
Node Type: note [id://946618]
help
Chatterbox?
 [Corion]: Do you want to wait for a key press before closing the window? [LanX]: I want the command line in the history [tye]: -Mouse [Corion]: Option a) would mean launching cmd.exe /k c:\path\to\ batchfile- launching-perl- script.cmd. Option b) would be to add pause as the last line of said batch file. [LanX]: First day after holidays ... and already stressed by the fact that colleagues changed stuff without communication ... apparently I'm the only one trying to fight entropy [Corion]: LanX: The command is always in the history if you typed it in before. If you didn't type the command into the command line, it will not be there. I think there is doskey which can stuff command lines into the history LanX damns the cult of CB ;-) LanX WTF WTF WTF [LanX]: please forget my last 3 posts [LanX]: Yeah option a doesn't go into history

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (9)
As of 2017-03-27 15:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
Should Pluto Get Its Planethood Back?

Results (320 votes). Check out past polls.