This module finds all your globals and prints out their sizes (thanks to Devel::Size). Here's an example of its use. It can also return the data as a hashref instead of printing it. Is it worth putting on the CPAN?
[pudge@bourque Data]$ perl -MDevel::FindGlobals -wle 'print print_globals_sizes(exclude_match => [qw(warnings overload VERSION$ EXPORT(_\w+)?$ Exporter Carp DynaLoader)])'
Name of SCALAR variable Size Total Size
========================================================================== ======
$main::%08 96 96
$main::%0F 103 103
$main::%16 41 41
$main::%17 96 96
$main::%17ARNING_BITS 96 96
$main::%18 29 29
$main::! 96 96
$main::" 26 26
$main::$ 16 16
$main::+ 96 96
$main::- 96 96
$main::/ 98 98
$main::0 99 99
$main::1 96 96
$main::@ 264 264
$main::] 43 43
Name of ARRAY variable Size Total Size
========================================================================== ======
@DB::args 56 56
@main::+ 108 108
@main::- 108 108
@main::ARGV 56 56
@main::INC 100 419
@main::_ 68 437
Name of HASH variable Size Total Size
========================================================================== ======
%Config::Config 144 144
%main::@ 92 92
%main::ENV 1175 4824
%main::INC 540 1345
%main::SIG 1255 4424
Now Playing: It's Nice To Be With You - The Monkees (The Monkees Greatest Hits)
Useful (Score:2)
I believe it's useful and CPAN-worthy, notably for modperl apps. It would be nice to be able to filter out Perl's builtins as well to see what genuine globals have been introduced.
-- Robin Berjon [berjon.com]
Re:Useful (Score:2)
Umm... yeah? (Score:2)
CPAN that puppy forthwith. I agree that more filtering of Perl built-ins would be good (not just filter patterns, but actually avoiding $!, @+, @DB::args, etc.).
--rjray
Re:Umm... yeah? (Score:2)
I'll commit it probably next week. My computing life is a shambles and I need to clean it up.