The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Devel::FindGlobals - Find global variables and their size

SYNOPSIS

        use Devel::FindGlobals;
        print print_globals_sizes();

DESCRIPTION

This module just runs around and over the symbol table, finds global variables, gets their sizes with Devel::Size, and then prints them out.

find_globals() just finds the globals (and returns a hashref), and find_globals_sizes() returns the globals and the sizes in a hashref. print_globals_sizes() prints out that data in a pretty table.

find_globals() hashref is of the form $hash->{TYPE}{NAME}, where TYPE is SCALAR, ARRAY, HASH (types stored in @Devel::FindGlobals::TYPES).

find_globals_sizes() hashref is the same, except that the value of the record is not 1 but an arrayref of size and total_size (size is the size of the variable itself, and total_size counts up all the other members of the variable, for arrayrefs and hashrefs).

print_globals_sizes() accepts an OPTIONS hash. Currently recognized options are:

  • ignore_files

    Ignore file globals (like $main::_</usr/local/lib/perl5/5.8.0/vars.pm). Default value is true.

  • ignore_undef_scalars

    Ignore scalars that exist, but are not defined. Default value is true.

  • exclude_match

    An arrayref of strings to match; e.g., ['^VERSION$', '^Debug']. Will not print variables matching any of the expressions.

  • include_match

    Same as exclude_match, except for variables to exclusively include, instead of strings to exclude.

  • lexicals

    A hashref of name = reference> for lexical variables to include in the report.

BUGS

Code references, being not handled by Devel::Size, are not handled by this module.

AUTHOR

Chris Nandor <pudge@pobox.com>, http://pudge.net/

Copyright (c) 2002-2004 Chris Nandor. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

perl(1), perlguts(1), Devel::Size.