יובל קוג'מן (Yuval Kogman)

NAME

Object::Meta::Plugin::ExportList - an implementation of a very simple, string only export list.

SYNOPSIS

        # the proper way

        my $plugin = GoodPlugin->new();
        $host->plug($plugin);

        package GoodPlugin;

        # ...

        sub exports {
                qw/some methods/;
        }

        sub init {
                my $self = shift;
                return Object::Meta::Plugin::ExportList->new($self};
        }

        # or if you prefer.... *drum roll*
        # the naughty way

        my $plugin = BadPlugin->new();  # doesn't need to be a plugin per se, since
                                                                        # it's not verified by plug(). All it needs
                                                                        # is to have a working can(). the export
                                                                        # list is responsible for the rest.
                                                                        # in short, this way init() needn't be defined.

        my $export = Object::Meta::Plugin::ExportList->new($plugin, qw/foo bar/);

        $host->register($export);

DESCRIPTION

An export list is an object a plugin hands over to a host, stating what it is going to give it. This is a very basic implementation, providing only the bare minimum methods needed to register a plugin. Unregistering one requires even less.

METHODS

new PLUGIN [ METHODS ... ]

Creates a new export list object. When passed only a plugin, and no method names as additional arguments,

plugin

Returns the reference to the plugin object it represents.

exists METHOD

Returns truth if the method stated is exported.

list METHOD

Returns a list of exported method names.

merge EXPORTLIST

Performs an OR with the methods of the argued export list.

unmerge EXPORTLIST

Performs an AND of the COMPLEMENT of the argued export list.

CAVEATS

  • Relies on the plugin implementation to provide a non-mandatory extension - the exports method. This method is available in all the Object::Meta::Plugin::Useful variants, and since Object::Meta::Plugin is not usable on it's own this is probably ok.

BUGS

Not that I know of, for the while being at least.

COPYRIGHT & LICENSE

        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.

AUTHOR

Yuval Kogman <nothingmuch@woobling.org>

SEE ALSO

Object::Meta::Plugin, Object::Meta::Plugin::Useful, Object::Meta::Plugin::Host