From: Arthur Axel 'fREW' Schmidt Date: Sun, 4 Nov 2012 00:24:26 +0000 (-0500) Subject: rename arg_router to router as it's not an argument X-Git-Tag: v0.005000_01~10 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=139ded544501587097e665a6edcaee84b4c4283e;p=p5sagit%2FLog-Contextual.git rename arg_router to router as it's not an argument --- diff --git a/lib/Log/Contextual.pm b/lib/Log/Contextual.pm index 248a731..a491691 100644 --- a/lib/Log/Contextual.pm +++ b/lib/Log/Contextual.pm @@ -35,7 +35,7 @@ export_tag dlog => ('____'); export_tag log => ('____'); import_arguments qw(logger package_logger default_logger); -sub arg_router { +sub router { our $Router_Instance ||= do { require Log::Contextual::Router; Log::Contextual::Router->new @@ -49,7 +49,7 @@ sub arg_default_logger { $_[1] } sub before_import { my ($class, $importer, $spec) = @_; - my $router = $class->arg_router; + my $router = $class->router; my $exports = $spec->exports; die 'Log::Contextual does not have a default import list' @@ -58,7 +58,7 @@ sub before_import { $router->before_import(@_); $spec->add_export('&set_logger', sub { - my $router = $class->arg_router; + my $router = $class->router; die ref($router) . " does not support set_logger()" unless $router->does('Log::Contextual::Role::Router::SetLogger'); @@ -67,7 +67,7 @@ sub before_import { }) if $exports->{'&set_logger'}; $spec->add_export('&with_logger', sub { - my $router = $class->arg_router; + my $router = $class->router; die ref($router) . " does not support with_logger()" unless $router->does('Log::Contextual::Role::Router::WithLogger'); @@ -128,7 +128,7 @@ sub before_import { } } -sub after_import { $_[0]->arg_router->after_import(@_) } +sub after_import { $_[0]->router->after_import(@_) } 1; diff --git a/t/lib/BaseLogger.pm b/t/lib/BaseLogger.pm index 614985f..3b832fd 100644 --- a/t/lib/BaseLogger.pm +++ b/t/lib/BaseLogger.pm @@ -7,7 +7,7 @@ my $logger = DumbLogger2->new; sub arg_levels { $_[1] || [qw(lol wut zomg)] } sub arg_logger { $_[1] || $logger } -sub arg_router { +sub router { our $Router_Instance ||= do { require Log::Contextual::Router; Log::Contextual::Router->new