Symbol::List - get a list of symbols that match a certain type


NAME

Symbol::List - get a list of symbols that match a certain type


SYNOPSIS

    use Devel::GetSymbols qw(symbols subs);
    my @subroutines = symbols('CODE');
    my @subroutines = subs(); # equal
    # @subroutines includes 'symbols', because it was imported
    # into this package.
    use Data::Dumper;
    print "$_\n" for symbols('SCALAR', 'Data::Dumper');
    use base 'Exporter';
    @EXPORT_OK = symbols('CODE');                # Yuch.
    @EXPORT_OK = subs();                         # Ditto.
    @EXPORT = grep /^[A-Z_]+$/, symbols('CODE'); # Export constants


DESCRIPTION

This module just does a grep on some keys, but can save a lot of development time.

symbols
Takes type and optional package name as arguments and returns a list of symbols that are of that type and in that package. Defaults to the calling package. Type can be one of qw(ARRAY CODE FORMAT GLOB HASH IO SCALAR). I guess CODE will be used most :)

subs
Shorthand for symbols('CODE'). Does not take arguments (use symbols if you want to get it from another package).


KNOWN BUGS

None yet


AUTHOR

Juerd <juerd@juerd.nl>

 Symbol::List - get a list of symbols that match a certain type