X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FComponent.pm;h=13c9323440515f52c485e92a119f84f0402a45ac;hb=67fd25bc03bc87a19db237a13fcb1cd157252101;hp=1b494a2f3a3caf99976dd961ce934ec7d76ee4b8;hpb=d8ccdd9d64915be00c29a7ab21d9275431235697;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Component.pm b/lib/Catalyst/Component.pm index 1b494a2..13c9323 100644 --- a/lib/Catalyst/Component.pm +++ b/lib/Catalyst/Component.pm @@ -9,6 +9,8 @@ use Devel::InnerPackage (); use MRO::Compat; use mro 'c3'; use Scalar::Util 'blessed'; +use Class::Load 'is_class_loaded'; +use Moose::Util 'find_meta'; use namespace::clean -except => 'meta'; with 'MooseX::Emulate::Class::Accessor::Fast'; @@ -61,7 +63,7 @@ It provides you with a generic new() for component construction through Catalyst component loader with config() support and a process() method placeholder. B that calling C<< $self->config >> inside a component is strongly -disrecommended - the correctly merged config should have already been +not recommended - the correctly merged config should have already been passed to the constructor and stored in attributes - accessing the config accessor directly from an instance is likely to get the wrong values (as it only holds the class wide config, not things loaded @@ -93,7 +95,7 @@ sub BUILDARGS { } elsif (@_ == 2) { # is it ($app, $args) or foo => 'bar' ? if (blessed($_[0])) { $args = $_[1] if ref($_[1]) eq 'HASH'; - } elsif (Class::MOP::is_class_loaded($_[0]) && + } elsif (is_class_loaded($_[0]) && $_[0]->isa('Catalyst') && ref($_[1]) eq 'HASH') { $args = $_[1]; } else { @@ -137,7 +139,7 @@ sub config { # work in a subclass. # TODO maybe this should be a ClassData option? my $class = blessed($self) || $self; - my $meta = Class::MOP::get_metaclass_by_name($class); + my $meta = find_meta($class); unless (${ $meta->get_or_add_package_symbol('$_config') }) { # Call merge_hashes to ensure we deep copy the parent # config onto the subclass