Add Vladimir to contributors and update README
[catagits/Catalyst-View-Component-SubInclude.git] / lib / Catalyst / View / Component / SubInclude.pm
index efd8b33..f63a058 100644 (file)
@@ -19,7 +19,7 @@ Version 0.09
 
 =cut
 
-our $VERSION = '0.09';
+our $VERSION = '0.10';
 $VERSION = eval $VERSION;
 
 =head1 SYNOPSIS
@@ -116,6 +116,12 @@ has 'subinclude_plugin' => (
     isa => Str,
 );
 
+has subinclude => (
+    is => 'ro',
+    isa => HashRef,
+    default => sub { {} },
+);
+
 around 'new' => sub {
     my $next = shift;
     my $class = shift;
@@ -162,19 +168,23 @@ 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};
 
     my $plugin_config = Catalyst::Utils::merge_hashes(
-        $self->config->{subinclude}->{ALL}||{},
-        $self->config->{subinclude}->{$plugin}||{}
+        $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
@@ -199,6 +209,10 @@ Nilson Santos Figueiredo Junior, C<< <nilsonsfj at cpan.org> >>
 
 Tomas Doran (t0m) C<< <bobtfish@bobtfish.net >>.
 
+Vladimir Timofeev, C<< <vovkasm at gmail.com> >>.
+
+Wallace Reis (wreis) C<< <wreis@cpan.org> >>.
+
 =head1 SPONSORSHIP
 
 Development sponsored by Ionzero LLC L<http://www.ionzero.com/>.