X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst%2FLog.pm;h=1a33c982466dd00db7a6ff3f3458b68e158375ee;hp=01ff75f603a46e27b63443e34a01fa64067e3876;hb=6680c772eaa987eafdb32e9437fd2d649dc914d9;hpb=3cdcf968aa321182c36f5fe4f499d581f59bdeac diff --git a/lib/Catalyst/Log.pm b/lib/Catalyst/Log.pm index 01ff75f..1a33c98 100644 --- a/lib/Catalyst/Log.pm +++ b/lib/Catalyst/Log.pm @@ -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 _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 ) = @_; @@ -105,6 +99,9 @@ sub _send_to_log { print STDERR @_; } +no Moose; +__PACKAGE__->meta->make_immutable(); + 1; __END__ @@ -256,4 +253,6 @@ it under the same terms as Perl itself. =cut +__PACKAGE__->meta->make_immutable; + 1;