With the load-module probe, you can see at what point modules are loaded using ‘do’, ‘use’ or ‘require’.
The following code:
#!/usr/local/bin/perl -w use strict; my $initial = "there once was a fish. Its feet were small"; my $post = func($initial); my $post2 = func($initial); print "$post\n"; do 'call2.pl'; #eval `cat call2.pl`; #use CGI::Session; sub func { $_[0] =~ s/there/There/; return $_[0]; }
produces the following output:
== call1.pl ========================================================== perl*::perl_alloc:main-enter perl*::perl_alloc:main-exit, (0/0) (56 uS) perl*::perl_construct:main-enter perl*::perl_construct:main-exit, (12/0) (624 uS) perl*::perl_parse:main-enter >>>>>>>>>> perl*::Perl_utilize:load-module-start (strict) >>>>>>>>>> perl*::Perl_ck_require:load-module-start (strict) <<<<<<<<<< perl*::Perl_ck_require:load-module-end (strict.pm) (3 uS) >>>>>>>>>> perl*::Perl_ck_require:load-module-start (Carp) <<<<<<<<<< perl*::Perl_ck_require:load-module-end (Carp.pm) (2 uS) >>>>>>>>>> perl*::Perl_dofile:load-module-start (call2.pl) <<<<<<<<<< perl*::Perl_dofile:load-module-end (call2.pl) (3 uS) perl*::perl_parse:main-exit, (299/46) (3069 uS) perl*::perl_run:main-enter >>>>>>>>>> perl*::Perl_utilize:load-module-start (strict) >>>>>>>>>> perl*::Perl_ck_require:load-module-start (strict) <<<<<<<<<< perl*::Perl_ck_require:load-module-end (strict.pm) (3 uS) perl*::perl_run:main-exit, (69/45) (533 uS) perl*::perl_destruct:main-enter perl*::perl_destruct:main-exit, (0/3) (24 uS)
see my perl5.8 trac for the code -or grab the modified 5.8.8 source from svn
the perl*::Perl_utilize:load-module-end probe is currently being worked on, and I really would like to see the actual parse component of the load separated out.