NAME
Aspect::Symbol::Enum - Functions to extract symbol table information
SYNOPSIS
use Aspect::Symbol::Enum ':all';
for my $pkg (get_user_packages) {
print "$pkg\::$_()\n" for get_CODE($pkg);
}
DESCRIPTION
This module exports functions that extract information about available packages and symbols of certain types (scalars, arrays, hashes, subroutines) in those packages.
EXPORT
None by default.
EXPORT_OK
get_packages([STRING, HASHREF])
-
Returns a list of the names of all packages in existence in the program at the time. If no arguments are given, the search starts from the base symbol table,
%::
, otherwise the search starts from symbol table indicated by the string argument. The optional second parameter is a reference to a hash whose keys indicate package names we're not interested in. This argument is for internal use. get_user_packages()
-
Returns those package names from
get_packages
that aren't in existence when starting even the most minimal of Perl programs. This should leave all packages loaded (e.g., viause()
) or otherwise declared by the main program. The following packages are not considered to be user packages; in the list there are packages likesUNIVERSAL
that are available in every program by default as well as packages likeExporter
that are loaded byAspect::Symbol::Enum
.attributes base fields lib Config DB UNIVERSAL DynaLoader Exporter Exporter::Heavy warnings IO IO::Handle strict Carp CORE CORE::GLOBAL
get_symbols(STRING, STRING)
-
Returns a list of glob names within the symbol table of the package denoted by the first argument (without the package name) that have a slot of thetype indicated by the second argument. The second argument can be one of
CODE
,SCALAR
,ARRAY
orHASH
.This module can export certain convenience functions based on
get_symbols
: get_CODE(STRING)
,get_code(STRING)
-
Returns a list of glob names within the symbol table of the package denoted by the argument (without the package name) that have a
CODE
slot. Effectively, a list of all subroutine names in the given package. get_SCALAR(STRING)
,get_scalar(STRING)
-
Returns a list of glob names within the symbol table of the package denoted by the argument (without the package name) that have a
SCALAR
slot. Effectively, a list of all scalar variables in the given package. get_ARRAY(STRING)
,get_array(STRING)
-
Returns a list of glob names within the symbol table of the package denoted by the argument (without the package name) that have a
ARRAY
slot. Effectively, a list of all array variables in the given package. get_HASH(STRING)
,get_hash(STRING)
-
Returns a list of glob names within the symbol table of the package denoted by the argument (without the package name) that have a
HASH
slot. Effectively, a list of all hash variables in the given package.
EXPORT_TAGS
Using :all
you can import all of the above functions.
BUGS
None known so far. If you find any bugs or oddities, please do inform the author.
AUTHOR
Marcel Grunauer, <marcel@codewerk.com>
COPYRIGHT
Copyright 2001 Marcel Grunauer. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
SEE ALSO
perl(1), Aspect::Intro(3pm), Aspect::Overview(3pm).