Devel::ModuleDumper - show module information automatically
$ perl -d:ModuleDumper -MData::Dumper -e 'print "foo!\n"' foo! Perl 5.012002 Carp 1.17 Data::Dumper 2.125 Exporter 5.64_01
Devel::ModuleDumper shows the module information at the end of your script.
Devel::ModuleDumper
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.
-d:ModuleDumper
By default, some modules are filtered. If you set MODULEDUMPER_SHOW_ALL=1, all module information will output.
MODULEDUMPER_SHOW_ALL=1
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
use Devel::ModuleDumper qw/option1[ option2...]/;
show all modules. same as MODULEDUMPER_SHOW_ALL environment.
MODULEDUMPER_SHOW_ALL
show modules which are loaded at BEGIN phase.
Actually, typical pragma modules are filtered by default. If you give pragma option, then the pragma modules will be shown.
pragma
Several modules are filtered. If you give skip option, then these modules will be shown.
skip
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.
*.pl
pl
By default, dump result is put to STDOUT. If you want to switch STDOUT to STDERR, you set -stderr option.
-stderr
To build an information of modules. This method returns the string;
Devel::ModuleDumper is hosted on github: http://github.com/bayashi/Devel-ModuleDumper
Welcome your patches and issues :D
Dai Okabayashi <bayashi@cpan.org>
Devel::Loaded, Devel::Modlist, Devel::VersionDump, Module::PrintUsed
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
To install Devel::ModuleDumper, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Devel::ModuleDumper
CPAN shell
perl -MCPAN -e shell install Devel::ModuleDumper
For more information on module installation, please visit the detailed CPAN module installation guide.