eliminate usage of each() on hashes we don't own, since we can't guarantee the iterat...
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Log.pm
index 01ff75f..1314ceb 100644 (file)
@@ -1,21 +1,14 @@
 package Catalyst::Log;
 
-use strict;
-#use base 'Class::Accessor::Fast';
+use Moose;
 use Data::Dump;
 
 our %LEVELS = ();
 
-use Moose;
-
 has level => (is => 'rw');
 has _body  => (is => 'rw');
 has abort => (is => 'rw');
 
-#__PACKAGE__->mk_accessors('level');
-#__PACKAGE__->mk_accessors('body');
-#__PACKAGE__->mk_accessors('abort');
-
 {
     my @levels = qw[ debug info warn error fatal ];
 
@@ -43,12 +36,13 @@ has abort => (is => 'rw');
     }
 }
 
-sub new {
+around new => sub {
+    my $orig = shift;
     my $class = shift;
-    my $self  = $class->SUPER::new;
+    my $self = $class->$orig;
     $self->levels( scalar(@_) ? @_ : keys %LEVELS );
     return $self;
-}
+};
 
 sub levels {
     my ( $self, @levels ) = @_;
@@ -256,4 +250,6 @@ it under the same terms as Perl itself.
 
 =cut
 
+__PACKAGE__->meta->make_immutable;
+
 1;