Dai Okabayashi

NAME

Devel::ModuleDumper - show module information automatically

SYNOPSIS

    $ perl -d:ModuleDumper -MData::Dumper -e 'print "foo!\n"'
    foo!
    Perl    5.012002
    Carp    1.17
    Data::Dumper    2.125
    Exporter        5.64_01

DESCRIPTION

Devel::ModuleDumper shows the module information at the end of your script.

This module is especially useful for a Benchmark report.

For example, here is the benchmark script.

    # crypt_benchmark.pl
    
    use strict;
    use warnings;

    use Benchmarks sub {

        use Digest::HMAC_SHA1 qw(hmac_sha1_hex);
        use Digest::HMAC_MD5 qw(hmac_md5_hex);

        my $STR = '@test123';
        my $KEY = 'ABC';

        {
            'hmac_sha1' => sub { hmac_sha1_hex($STR, $KEY); },
            'hmac_md5'  => sub { hmac_md5_hex($STR, $KEY); },
            'crypt'     => sub { crypt($STR, $KEY); },
        };
    };

To invoke with Devel::ModuleDumper.

    $ perl -d:ModuleDumper crypt_benchmark.pl
    
    Benchmark: running crypt, hmac_md5, hmac_sha1 for at least 1 CPU seconds...
         crypt:  1 wallclock secs ( 1.06 usr +  0.00 sys =  1.06 CPU) @ 108196.23/s (n=114688)
      hmac_md5:  1 wallclock secs ( 1.10 usr +  0.00 sys =  1.10 CPU) @ 195490.00/s (n=215039)
     hmac_sha1:  1 wallclock secs ( 1.03 usr +  0.00 sys =  1.03 CPU) @ 111346.60/s (n=114687)
                  Rate     crypt hmac_sha1  hmac_md5
    crypt     108196/s        --       -3%      -45%
    hmac_sha1 111347/s        3%        --      -43%
    hmac_md5  195490/s       81%       76%        --
    
    Perl    5.012002
    Benchmarks      0.05
    Carp    1.17
    Digest::base    1.16
    Digest::HMAC    1.03
    Digest::HMAC_MD5        1.01
    Digest::HMAC_SHA1       1.03
    Digest::MD5     2.39
    Digest::SHA     5.47
    Exporter        5.64_01
    Exporter::Heavy 5.64_01
    MIME::Base64    3.08
    Time::HiRes     1.9719

All you need to do is add -d:ModuleDumper.

ENVIRONMENT VARIABLE

MODULEDUMPER_SHOW_ALL

By default, some modules are filtered. If you set MODULEDUMPER_SHOW_ALL=1, all module information will output.

OPTIONS

If you set options at loading, then the modules will be shown what you want.

    $ perl -d:ModuleDumper=option1[,option2...] your_script.pl

or

    $ perl -M:Devel::ModuleDumper=option1[,option2...] your_script.pl

or

    use Devel::ModuleDumper qw/option1[ option2...]/;
all

show all modules. same as MODULEDUMPER_SHOW_ALL environment.

seen

show modules which are loaded at BEGIN phase.

pragma

Actually, typical pragma modules are filtered by default. If you give pragma option, then the pragma modules will be shown.

skip

Several modules are filtered. If you give skip option, then these modules will be shown.

pl

Sometime, you can find *.pl module(script) in loaded modules. These are filtered by default. If you give pl option, then these modules will be shown.

-stderr

By default, dump result is put to STDOUT. If you want to switch STDOUT to STDERR, you set -stderr option.

METHOD

show

To build an information of modules. This method returns the string;

REPOSITORY

Devel::ModuleDumper is hosted on github: http://github.com/bayashi/Devel-ModuleDumper

Welcome your patches and issues :D

AUTHOR

Dai Okabayashi <bayashi@cpan.org>

SEE ALSO

Devel::Loaded, Devel::Modlist, Devel::VersionDump, Module::PrintUsed

LICENSE

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.