X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst.pm;h=c131008a189c9e9cd36ec3144e1a828fb265e64c;hb=e5210a95f78613a598abbfc7d29d92605d5bbad0;hp=62fc85b701fbe72d418969ca903052abeeb5d377;hpb=acca8cd512f838b4f863486de70d514ac0fae4bf;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 62fc85b..c131008 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -1,6 +1,7 @@ package Catalyst; use Moose; +use Moose::Meta::Class (); extends 'Catalyst::Component'; use Moose::Util qw/find_meta/; use bytes; @@ -1102,7 +1103,7 @@ EOF B::Hooks::EndOfScope::on_scope_end { my $meta = Class::MOP::get_metaclass_by_name($class); if ( $meta->is_immutable && ! { $meta->immutable_options }->{inline_constructor} ) { - die "You made your application class ($class) immutable, " + warn "You made your application class ($class) immutable, " . "but did not inline the constructor.\n" . "This will break catalyst, please pass " . "(replace_constructor => 1) when making your class immutable.\n"; @@ -2174,7 +2175,7 @@ sub setup_components { sub _controller_init_base_classes { my ($app_class, $component) = @_; foreach my $class ( reverse @{ mro::get_linear_isa($component) } ) { - Moose->init_meta( for_class => $class ) + Moose::Meta::Class->initialize( $class ) unless find_meta($class); } } @@ -2478,9 +2479,6 @@ the plugin name does not begin with C. my ( $proto, $plugin, $instant ) = @_; my $class = ref $proto || $proto; - # no ignore_loaded here, the plugin may already have been - # defined in memory and we don't want to error on "no file" if so - Class::MOP::load_class( $plugin ); $proto->_plugins->{$plugin} = 1; @@ -2501,14 +2499,27 @@ the plugin name does not begin with C. $class->_plugins( {} ) unless $class->_plugins; $plugins ||= []; - for my $plugin ( reverse @$plugins ) { - unless ( $plugin =~ s/\A\+// ) { - $plugin = "Catalyst::Plugin::$plugin"; - } + my @plugins = map { s/\A\+// ? $_ : "Catalyst::Plugin::$_" } @$plugins; + + Class::MOP::load_class($_) for @plugins; + + for my $plugin ( reverse @plugins ) { + my $meta = find_meta($plugin); + next if $meta && $meta->isa('Moose::Meta::Role'); $class->_register_plugin($plugin); } + + my @roles = + map { $_->name } + grep { $_ && blessed($_) && $_->isa('Moose::Meta::Role') } + map { find_meta($_) } + @plugins; + + Moose::Util::apply_all_roles( + $class => @roles + ) if @roles; } } @@ -2748,6 +2759,8 @@ phaylon: Robert Sedlacek rafl: Florian Ragwitz +random: Roland Lammel + sky: Arthur Bergman the_jester: Jesse Sheidlower