[Catalyst-commits] r7961 - in Catalyst-Runtime/5.80/trunk: .
lib/Catalyst
groditi at dev.catalyst.perl.org
groditi at dev.catalyst.perl.org
Mon Jun 23 21:59:56 BST 2008
Author: groditi
Date: 2008-06-23 21:59:56 +0100 (Mon, 23 Jun 2008)
New Revision: 7961
Modified:
Catalyst-Runtime/5.80/trunk/
Catalyst-Runtime/5.80/trunk/lib/Catalyst/Exception.pm
Catalyst-Runtime/5.80/trunk/lib/Catalyst/Log.pm
Log:
r16983 at martha (orig r7506): groditi | 2008-03-15 01:21:42 -0400
reapplying changes by konobi that I accidentally undid earlier. sorry about that
Property changes on: Catalyst-Runtime/5.80/trunk
___________________________________________________________________
Name: svk:merge
- 1c72fc7c-9ce4-42af-bf25-3bfe470ff1e8:/local/Catalyst/trunk/Catalyst-Runtime:9763
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.70/trunk:7576
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/moose:7505
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-ChildOf:4443
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-Runtime-jrockway:5857
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-component-setup:4320
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-docs:4325
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/current/Catalyst-Runtime:5142
4ad37cd2-5fec-0310-835f-b3785c72a374:/trunk/Catalyst:4483
4ad37cd2-5fec-0310-835f-b3785c72a374:/trunk/Catalyst-Runtime:6165
d7608cd0-831c-0410-93c0-e5b306c3c028:/local/Catalyst/Catalyst-Runtime:8339
d7608cd0-831c-0410-93c0-e5b306c3c028:/local/Catalyst/Catalyst-Runtime-jrockway:8342
e56d974f-7718-0410-8b1c-b347a71765b2:/local/Catalyst-Runtime:6511
e56d974f-7718-0410-8b1c-b347a71765b2:/local/Catalyst-Runtime-current:10442
+ 1c72fc7c-9ce4-42af-bf25-3bfe470ff1e8:/local/Catalyst/trunk/Catalyst-Runtime:9763
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.70/trunk:7576
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/moose:7506
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-ChildOf:4443
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-Runtime-jrockway:5857
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-component-setup:4320
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-docs:4325
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/current/Catalyst-Runtime:5142
4ad37cd2-5fec-0310-835f-b3785c72a374:/trunk/Catalyst:4483
4ad37cd2-5fec-0310-835f-b3785c72a374:/trunk/Catalyst-Runtime:6165
d7608cd0-831c-0410-93c0-e5b306c3c028:/local/Catalyst/Catalyst-Runtime:8339
d7608cd0-831c-0410-93c0-e5b306c3c028:/local/Catalyst/Catalyst-Runtime-jrockway:8342
e56d974f-7718-0410-8b1c-b347a71765b2:/local/Catalyst-Runtime:6511
e56d974f-7718-0410-8b1c-b347a71765b2:/local/Catalyst-Runtime-current:10442
Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/Exception.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/Exception.pm 2008-06-23 20:59:49 UTC (rev 7960)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/Exception.pm 2008-06-23 20:59:56 UTC (rev 7961)
@@ -1,15 +1,10 @@
package Catalyst::Exception;
-use strict;
-use vars qw[@ISA $CATALYST_EXCEPTION_CLASS];
+# XXX: See bottom of file for Exception implementation
-BEGIN {
- push( @ISA, $CATALYST_EXCEPTION_CLASS || 'Catalyst::Exception::Base' );
-}
-
package Catalyst::Exception::Base;
-use strict;
+use Moose;
use Carp ();
=head1 NAME
@@ -49,6 +44,10 @@
Carp::croak($message);
}
+=head2 meta
+
+Provided by Moose
+
=head1 AUTHOR
Sebastian Riedel, C<sri at cpan.org>
@@ -61,4 +60,13 @@
=cut
+package Catalyst::Exception;
+
+use Moose;
+use vars qw[$CATALYST_EXCEPTION_CLASS];
+
+BEGIN {
+ extends($CATALYST_EXCEPTION_CLASS || 'Catalyst::Exception::Base');
+}
+
1;
Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/Log.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/Log.pm 2008-06-23 20:59:49 UTC (rev 7960)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/Log.pm 2008-06-23 20:59:56 UTC (rev 7961)
@@ -1,15 +1,21 @@
package Catalyst::Log;
use strict;
-use base 'Class::Accessor::Fast';
+#use base 'Class::Accessor::Fast';
use Data::Dump;
our %LEVELS = ();
-__PACKAGE__->mk_accessors('level');
-__PACKAGE__->mk_accessors('body');
-__PACKAGE__->mk_accessors('abort');
+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 ];
@@ -25,14 +31,14 @@
*{$name} = sub {
my $self = shift;
- if ( $self->{level} & $level ) {
+ if ( $self->level & $level ) {
$self->_log( $name, @_ );
}
};
*{"is_$name"} = sub {
my $self = shift;
- return $self->{level} & $level;
+ return $self->level & $level;
};
}
}
@@ -52,12 +58,20 @@
sub enable {
my ( $self, @levels ) = @_;
- $self->{level} |= $_ for map { $LEVELS{$_} } @levels;
+ my $level = $self->level;
+ for(map { $LEVELS{$_} } @levels){
+ $level |= $_;
+ }
+ $self->level($level);
}
sub disable {
my ( $self, @levels ) = @_;
- $self->{level} &= ~$_ for map { $LEVELS{$_} } @levels;
+ my $level = $self->level;
+ for(map { $LEVELS{$_} } @levels){
+ $level &= ~$_;
+ }
+ $self->level($level);
}
sub _dump {
@@ -70,18 +84,20 @@
my $level = shift;
my $message = join( "\n", @_ );
$message .= "\n" unless $message =~ /\n$/;
- $self->{body} .= sprintf( "[%s] %s", $level, $message );
+ my $body = $self->_body;
+ $body .= sprintf( "[%s] %s", $level, $message );
+ $self->_body($body);
}
sub _flush {
my $self = shift;
- if ( $self->abort || !$self->body ) {
+ if ( $self->abort || !$self->_body ) {
$self->abort(undef);
}
else {
- $self->_send_to_log( $self->body );
+ $self->_send_to_log( $self->_body );
}
- $self->body(undef);
+ $self->_body(undef);
}
sub _send_to_log {
@@ -169,6 +185,10 @@
$log = Catalyst::Log->new;
$log = Catalyst::Log->new( 'warn', 'error' );
+=head2 level
+
+Contains a bitmask of the currently set log levels.
+
=head2 levels
Set log levels
@@ -217,6 +237,8 @@
You may subclass this module and override this method to get finer control
over the log output.
+=head2 meta
+
=head1 SEE ALSO
L<Catalyst>.
More information about the Catalyst-commits
mailing list