http://qs321.pair.com?node_id=102496

koolade has asked for the wisdom of the Perl Monks concerning the following question: (debugging)

Using Devel::DProf on some of my programs produces output such as is found at Devel::Dprof is your friend, where most of the time is shown in MODULE::BEGIN. Does anyone know what that means when there are no BEGIN blocks in the module? Or does it just represent total calls to that module's subs?

Originally posted as a Categorized Question.

  • Comment on Why does Devel::DProf report so much time in BEGIN?

Replies are listed 'Best First'.
Re: Why does Devel::DProf report so much time in BEGIN?
by mikfire (Deacon) on Aug 06, 2001 at 21:14 UTC
    Without seeing your code, but having spent some time with Devel::DProf myself, I will guess that you are use'ing a number of modules.

    If I remember correctly,

    use foo;
    is implemented as
    BEGIN { require foo; import foo; }
    So, even though you are not explicitly using BEGIN blocks, you are using them implicitly through any use statements.

    I would delve into the correct manpages and verify my memory, but I am far from any machine with perl installed on it :( And I have no ssh to get to a machine I could so use.

    mikfire

Re: Why does Devel::DProf report so much time in BEGIN?
by Anonymous Monk on May 13, 2002 at 17:31 UTC
    After tirelessly searching for an answer to the same question (hence the search that turned up this page as a result), I ended up just tweaking my code until I got an answer. Several of my subroutines were missing from the DProf report until I removed all "use strict" and "use vars" lines from my code.

    I really have no idea why this made a difference. Sure would be nice if it were better-documented.

    Anyway, not sure if this helps you out 9 months after the fact, but thought I would share.

    --Bob