NAME

Object::Meta::Plugin::ExportList - An implementation of a very simple, string only export list, for use with Useful:: plugins.

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 [ INFO ] [ METHODS ... ]

Creates a new export list object. If it is a reference, it will be assumed that the second argument is an info object. Provided that is the case, no info object will be created, and the argued one will be used in place. Any remaining arguments will be method names to be exported. If none are specified, the return value from the plugin's exports method is used.

list

Returns a list of exported method names.

plugin

Returns the reference to the plugin object it represents.

exists METHODS ...

In scalar context will return truth if the first argument is a method that exists in the export list. In list context, it will return the method names given in @_, with the inexistent ones excluded.

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.

info [ INFO ]

Stores meta information regarding the plugin it represents. It's stored in the export list because the export list is what you use to communicate with the host.

Currently only the style field is defined, which will effect the kind of context shim that is created. The default is the most naive, but also the least efficient - the tied context.

Object::Meta::Plugin::ExportList::Info

This is just a hash, basically. It has an autoloader which will fetch a hash key by the method name with no arguments, or set the value to the first argument if it's there.

Deletion is not supported.

Known attributes

style

Defines the behavior of the context shim. See Object::Meta::Plugin::Host for a description of how this works.

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.

TODO

Nothing right now.

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.