From: Wallace Reis Date: Thu, 9 Dec 2010 04:11:08 +0000 (+0000) Subject: Let the plugin name be arbitrary X-Git-Tag: 0.10~1^2~7 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-View-Component-SubInclude.git;a=commitdiff_plain;h=b99299baac9c57b106a8fb02795f216088497f04 Let the plugin name be arbitrary --- diff --git a/lib/Catalyst/View/Component/SubInclude.pm b/lib/Catalyst/View/Component/SubInclude.pm index 5d12012..fc7d649 100644 --- a/lib/Catalyst/View/Component/SubInclude.pm +++ b/lib/Catalyst/View/Component/SubInclude.pm @@ -19,7 +19,7 @@ Version 0.09 =cut -our $VERSION = '0.09'; +our $VERSION = '0.10'; $VERSION = eval $VERSION; =head1 SYNOPSIS @@ -168,8 +168,6 @@ has _subinclude_plugin_class_instance_cache => ( sub _subinclude_plugin_class_instance { my ($self, $plugin) = @_; - my $class = $plugin =~ /::/ ? $plugin : __PACKAGE__ . '::' . $plugin; - my $cache = $self->_subinclude_plugin_class_instance_cache; return $cache->{$plugin} if exists $cache->{$plugin}; @@ -177,10 +175,16 @@ sub _subinclude_plugin_class_instance { $self->subinclude->{ALL}||{}, $self->subinclude->{$plugin}||{} ); + my $short_class = $plugin_config->{'class'} ? + delete $plugin_config->{'class'} + : $plugin; + my $class = $short_class =~ /::/ ? + $short_class + : __PACKAGE__ . '::' . $short_class; Class::MOP::load_class($class); - return $cache->{$plugin} = $class->new($plugin_config); + return $cache->{$class} = $class->new($plugin_config); } =head1 SEE ALSO