Object::Meta::Plugin::Useful::Greedy - A useful plugin base class which gobbles up reasonable parts of the symbol table at export time.
package Foo; use base 'Object::Meta::Plugin::Useful::Greedy'; sub new { # ... } sub ppretty { # ... } sub ver_pretty { # ... } sub ugly { # will not be exported because of the pattern # ... } sub _filter { grep {/pretty/} @_; }
This is a base class for a pretty standard, pretty easy plugin. When export is called it goes through the symbol table of the plugin's package, as per ref $self, and so forth through all the @ISAs it finds. The functions it finds along the way are collected, and filtered.
export
ref $self
This rummages it's class's symbol table, and returns a list of method names as filtered by _filter.
_filter
This takes a list of method names, and munges it into something. The current example will filter things that don't look pretty (don't start with an underscore), and that are probably undesired (new, init, exports, carp & croak).
new
init
exports
carp
croak
You can define _filter in your class, if you want more control of the filtering process.
@_ passed to this method will consist of a duplicate free list of all the bareword method names found in all of the packages that the plugin's class @ISA contains, as determined by Class::ISA.
Does not work on classless objects and such. The plugin in question must be blessed into a real class, with a real symbol table, and a real @ISA full of real classes with real what-nots. How dull.
Relies on the non core module Devel::Symdump.
Peh! You must be kididgn!
Nothing right now.
Copyright 2003 Yuval Kogman. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Yuval Kogman <nothingmuch@woobling.org>
Object::Meta::Plugin, Object::Meta::Plugin::Useful, Object::meta::Plugin::Useful::Generic, Object::Meta::Plugin::Useful::Meta.
To install Object::Meta::Plugin, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Object::Meta::Plugin
CPAN shell
perl -MCPAN -e shell install Object::Meta::Plugin
For more information on module installation, please visit the detailed CPAN module installation guide.