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

NAME

Package::Watchdog::Util - Utility functions for use within Package::Watchdog objects.

DESCRIPTION

Collection of utility functions. All functions in the package are exported.

FUNCTIONS

build_accessors( @ACCESSOR_LIST )

Create an accessor method for each accessor name passed in. Accessors store and retrieve data from $self->{ $accessor }. Determines which package the accessors should be added to via caller().

expand_subs( $package, $subs )

Takes a package and list of subs, if the list is empty or undefined than all subs in the package will be returned. If the list contains '*' then the return will be all the susb in the list in addition to all the subs in the package.

Note: All subs in a package does not include inherited subs.

$subs = combine_subs( $setA, $setB )

Combine 2 arrayrefs of sub names into one arrayref containign entirely unique items.

@list = get_all_subs( $package )

Returns all the sub names in the package.

%subs = copy_subs( $package, $subs )

Get references to all the specified subs in the specified package.

$subs must be specified, it will not default to all susb in package.

return datastructure:

    %subs = (
        name => ref,
        ...
    );
$ref = copy_sub( $package, $sub )

Get the coderef for the specified sub in the specified package. If the sub is inherited, a ref to it will still be returned.

set_sub( $package, $sub, $new )

$new should be a coderef.

If $new is undef or omitted, the specified sub will be deleted from the package.

AUTHORS

Chad Granum chad@opensourcery.com

COPYRIGHT

Copyright (C) 2009 OpenSourcery, LLC

Package-Watchdog is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Package-Watchdog is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

Package-Watchdog is packaged with a copy of the GNU General Public License. Please see docs/COPYING in this distribution.