X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst.pm;h=cef7ac7be4989384fcde50e97e808fce8304230d;hb=54bee50ff7b3e30e2c370eb6249e021229cb9c6b;hp=8a1167f8ec4b29b2b133b06d8546fbfcd4178047;hpb=54f4bfeffdb580af3e4668d31c855bccb1e0623a;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 8a1167f..cef7ac7 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -8,7 +8,7 @@ use Moose; use Class::MOP::Object (); extends 'Catalyst::Component'; use bytes; -use B::Hooks::EndOfScope; +use Scope::Upper (); use Catalyst::Exception; use Catalyst::Log; use Catalyst::Request; @@ -1024,10 +1024,10 @@ EOF # Note however that we have to do the work on scope end, so that method # modifiers work correctly in MyApp (as you have to call setup _before_ # applying modifiers). - on_scope_end { + Scope::Upper::reap(sub { my $meta = $class->Moose::Object::meta(); $meta->make_immutable unless $meta->is_immutable; - }; + }, 1); $class->setup_finished(1); } @@ -2226,19 +2226,19 @@ or if the C<$CATALYST_DEBUG> environment variable is set to a true value. Note that if the log has already been setup, by either a previous call to C or by a call such as C<< __PACKAGE__->log( MyLogger->new ) >>, -that this method won't actually set up the log. +that this method won't actually set up the log object. =cut sub setup_log { my ( $class, $levels ) = @_; - my %levels; + $levels ||= ''; + $levels =~ s/^\s+//; + $levels =~ s/\s+$//; + my %levels = map { $_ => 1 } split /\s*,\s*/, $levels || ''; + unless ( $class->log ) { - $levels ||= ''; - $levels =~ s/^\s+//; - $levels =~ s/\s+$//; - %levels = map { $_ => 1 } split /\s*,\s*/, $levels || ''; $class->log( Catalyst::Log->new(keys %levels) ); }