On Mar 4, 2009, at 7:40 PM, Ian Sillitoe wrote:
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?
No, My::App->new should return an instance of My::App not of
My::View::HTML.
The idea of a ->new being a factory method is confusing IMO.
- Stevan