Try saving this to a file in your perl/lib/Devel/ directory as SubCheck.pm

use strict; package DB; CHECK{ print "$_ => $DB::sub{$_}" for sort keys %DB::sub; die 'Done'; +} sub DB{ return; } 1;

Then invoke a program that uses the modules you are interested in exploring using the following syntax:

perl -d:SubCheck yourscript.

You will get output that looks something like this (for a very simple program).

D:\Perl\test>perl58 -d:SubCheck HorL.pl8 AutoLoader::AUTOLOAD => d:/Perl/lib/AutoLoader.pm:22-116 AutoLoader::BEGIN => d:/Perl/lib/AutoLoader.pm:11-20 AutoLoader::__ANON__[d:/Perl/lib/AutoLoader.pm:96] => d:/Perl/lib/Auto +Loader.pm:96-96 AutoLoader::import => d:/Perl/lib/AutoLoader.pm:118-166 AutoLoader::unimport => d:/Perl/lib/AutoLoader.pm:168-171 Carp::carp => d:/Perl/lib/Carp.pm:193-193 Carp::cluck => d:/Perl/lib/Carp.pm:194-194 Carp::confess => d:/Perl/lib/Carp.pm:192-192 Carp::croak => d:/Perl/lib/Carp.pm:191-191 Carp::export_fail => d:/Perl/lib/Carp.pm:144-148 Carp::longmess => d:/Perl/lib/Carp.pm:157-168 Carp::shortmess => d:/Perl/lib/Carp.pm:177-183 Config::BEGIN => d:/Perl/lib/Config.pm:2-2 Config::CLEAR => d:/Perl/lib/Config.pm:1147-1147 Config::DELETE => d:/Perl/lib/Config.pm:1146-1146 Config::DESTROY => d:/Perl/lib/Config.pm:1172-1172 Config::EXISTS => d:/Perl/lib/Config.pm:1135-1143 Config::FETCH => d:/Perl/lib/Config.pm:1029-1115 Config::FIRSTKEY => d:/Perl/lib/Config.pm:1119-1124 Config::NEXTKEY => d:/Perl/lib/Config.pm:1126-1133 Config::STORE => d:/Perl/lib/Config.pm:1145-1145 Config::TIEHASH => d:/Perl/lib/Config.pm:1169-1169 Config::config_re => d:/Perl/lib/Config.pm:1154-1158 Config::config_sh => d:/Perl/lib/Config.pm:1150-1152 Config::config_vars => d:/Perl/lib/Config.pm:1160-1167 Config::import => d:/Perl/lib/Config.pm:7-16 Config::myconfig => d:/Perl/lib/Config.pm:1021-1027 DynaLoader::BEGIN => d:/Perl/lib/DynaLoader.pm:25-25 DynaLoader::bootstrap => d:/Perl/lib/DynaLoader.pm:130-250 DynaLoader::bootstrap_inherit => d:/Perl/lib/DynaLoader.pm:119-125 DynaLoader::croak => d:/Perl/lib/DynaLoader.pm:117-117 DynaLoader::dl_load_flags => d:/Perl/lib/DynaLoader.pm:48-48 Exporter::__ANON__[d:/Perl/lib/Exporter.pm:57] => d:/Perl/lib/Exporter +.pm:57-57 Exporter::as_heavy => d:/Perl/lib/Exporter.pm:15-22 Exporter::export => d:/Perl/lib/Exporter.pm:24-26 Exporter::export_fail => d:/Perl/lib/Exporter.pm:64-67 Exporter::export_ok_tags => d:/Perl/lib/Exporter.pm:81-83 Exporter::export_tags => d:/Perl/lib/Exporter.pm:77-79 Exporter::export_to_level => d:/Perl/lib/Exporter.pm:73-75 Exporter::import => d:/Perl/lib/Exporter.pm:28-60 Exporter::require_version => d:/Perl/lib/Exporter.pm:85-87 main::BEGIN => HorL.pl8:3-3 main::card_value => HorL.pl8:5-5 main::show_card => HorL.pl8:7-13 strict::bits => d:/Perl/lib/strict.pm:101-105 strict::import => d:/Perl/lib/strict.pm:107-110 strict::unimport => d:/Perl/lib/strict.pm:112-115 vars::BEGIN => d:/Perl/lib/vars.pm:8-8 vars::import => d:/Perl/lib/vars.pm:10-44 warnings::BEGIN => d:/Perl/lib/warnings.pm:130-130 warnings::Croaker => d:/Perl/lib/warnings.pm:292-295 warnings::__chk => d:/Perl/lib/warnings.pm:396-441 warnings::bits => d:/Perl/lib/warnings.pm:298-327 warnings::enabled => d:/Perl/lib/warnings.pm:444-453 warnings::import => d:/Perl/lib/warnings.pm:330-365 warnings::register::import => d:/Perl/lib/warnings/register.pm:36-49 warnings::register::mkMask => d:/Perl/lib/warnings/register.pm:27-33 warnings::unimport => d:/Perl/lib/warnings.pm:368-393 warnings::warn => d:/Perl/lib/warnings.pm:457-467 warnings::warnif => d:/Perl/lib/warnings.pm:470-487 Done at d:/Perl/lib/Devel/SubCheck.pm line 4. CHECK failed--call queue aborted.

The output is of the form packagename::subname => sourcefile:startline-endline.

The list should include all the subs the compiler knows about just prior to running the program. The program will not be run.

I guess this could be a candidate for uploading to CPAN if anyone would find it useful. Hardly seems worth it for 6 lines of code though?


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller



In reply to Re: Module Subs and Methods by BrowserUk
in thread Module Subs and Methods by artist

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.