Just occurred to me that a Moosier alternative may be much neater - remove
the need for the user to define an explicit factory object and coercions:

Plugins:

    My::View::Text
    My::View::HTML
    My::View::XML

Class:

    package My::App;
    use Moose;

    with 'MooseX::PluginFactory';

    has 'view',
        is => 'ro',
        isa => 'My::View',
        traits => [ 'PluginFactory' ],
        plugin_base => 'My::View';

Allows:

    $app = My::App->new( view => 'HTML' );

    $app->view; # My::View::HTML

Is this more sensible?

Cheers,

Ian



-- 
Ian Sillitoe
CATH Team -- http://cathdb.info

Reply via email to