Class::Wrap - Proxy an entire class's methods.


Class-Wrap documentation  | view source Contained in the Class-Wrap distribution.

Index


NAME

Top

Class::Wrap - Proxy an entire class's methods.

SYNOPSIS

Top

    use Some::Class;
    use Class::Wrap;

    wrap { print "We called the ", shift, " method!\n" } Some::Class;

DESCRIPTION

Top

There are several modules on CPAN which claim to help with wrapping classes; this is not like any of them. It provides a single pre- wrapper on all of a class's defined methods; it works on a class instead of an object basis.

The scenario I had in mind was wanting to know which methods of a particular class were being used by a very complex program; Class::Wrap helped understand what was being used and when, in order to make a decision about whether or not to replace the class.

It should be smart enough to do the right thing with AUTOLOADs.

EXPORTS

Top

The module provides the wrap function:

    wrap { coderef } "Package Name";

This will wrap all existing methods in the given class. The coderef is passed the name of the method called plus the parameters. This allows you to perform different actions based on the name of the method, so it's not a problem that only one wrapper fits the whole class.

AUTHOR

Top

Simon Cozens, simon@cpan.org

LICENSE

Top

You may use and distribute this module under the terms of the Artistic or GPL licenses, at your choice.


Class-Wrap documentation  | view source Contained in the Class-Wrap distribution.