Hi folks, got an odd one for you:
Why is Dprof saying my LTest::BEGIN and mail::BEGIN
are running twice ?
%Time ExclSec CumulS #Calls sec/call Csec/c Name
33.4 0.010 0.010 2 0.0050 0.0050 main::BEGIN <----- ?
0.00 0.000 -0.000 1 0.0000 - strict::import
0.00 0.000 -0.000 1 0.0000 - strict::bits
0.00 0.000 -0.000 2 0.0000 - LTest::BEGIN <----- ?
0.00 0.000 -0.000 1 0.0000 - Test2::BEGIN
I've actually got this problem but magnified in a larger
project which I'm trying to find a memory leak in.. I don't now
if this is related (BEGIN being run 4 to 17 times! in different
packages).
Is this my code, my not understanding Dprof or something else ?
perl -v
This is perl, v5.6.0 built for i386-linux
test.pl
-------
#!/usr/bin/perl
use strict;
use LTest;
package LTest;
BEGIN {
use Test2;
warn "Test is beginning\n";
}
print "Here\n";
1;
package Test2;
BEGIN {
warn "Test2 is beginning\n";
}
1;
Oh, running this code gives:
>./test.pl
Test2 is beginning
Test is beginning
Here
Making is even wierder! As 'Test is..' only
prints once.
Any help is much appreciated.
Cheers
Leo