From: Arthur Axel 'fREW' Schmidt Date: Sat, 20 Feb 2010 07:47:31 +0000 (-0600) Subject: use strinct and fuller import X-Git-Tag: v0.00100~26 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a2777569858d502c8889b8efe31af96ffcb9d4bd;p=p5sagit%2FLog-Contextual.git use strinct and fuller import --- diff --git a/lib/Log/Contextual.pm b/lib/Log/Contextual.pm index 9915155..d1da84f 100644 --- a/lib/Log/Contextual.pm +++ b/lib/Log/Contextual.pm @@ -1,13 +1,14 @@ package Log::Contextual; -use 5.006; +use strict; +use warnings; -$VERSION = '1.000'; +our $VERSION = '1.000'; require Exporter; use Data::Dumper::Concise; -BEGIN { @ISA = qw(Exporter) } +BEGIN { our @ISA = qw(Exporter) } my @dlog = (qw{ Dlog_debug DlogS_debug @@ -27,20 +28,29 @@ my @log = (qw{ log_fatal }); -@EXPORT_OK = ( +our @EXPORT_OK = ( @dlog, @log, qw{set_logger with_logger} ); -%EXPORT_TAGS = ( +our %EXPORT_TAGS = ( dlog => \@dlog, log => \@log, ); sub import { + my $package = shift; die 'Log::Contextual does not have a default import list' - if @_ == 1; - __PACKAGE__->export_to_level(1, shift, @_); + unless @_; + + for my $idx ( 0 .. $#_ ) { + if ( $_[$idx] eq '-logger' ) { + set_logger($_[$idx + 1]); + splice @_, $idx, 2; + last; + } + } + $package->export_to_level(1, $package, @_); } our $Get_Logger;