In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/00c1e5d87c16899a7d3efb49a4e6f0fc10dd2387?hp=476e237d2f6c7190af95ee1801cd6e85315b3262>
- Log ----------------------------------------------------------------- commit 00c1e5d87c16899a7d3efb49a4e6f0fc10dd2387 Author: Chris 'BinGOs' Williams <[email protected]> Date: Wed Jan 23 11:25:01 2013 +0000 Update Log-Message-Simple to CPAN version 0.10 [DELTA] Changes for 0.10 Wed Jan 23 08:10:42 GMT 2013 ================================================ * Add deprecate usage to warn if module is loaded from corelib. Log::Message::Simple is leaving core with v5.20.0, but will still be available on CPAN. ----------------------------------------------------------------------- Summary of changes: Porting/Maintainers.pl | 2 +- cpan/Log-Message-Simple/lib/Log/Message/Simple.pm | 33 +++++++++++---------- cpan/Log-Message-Simple/t/02_imports.t | 28 +++++++++--------- cpan/Log-Message-Simple/t/03_functions.t | 22 +++++++------- 4 files changed, 43 insertions(+), 42 deletions(-) diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl index adf31d6..205b4e3 100755 --- a/Porting/Maintainers.pl +++ b/Porting/Maintainers.pl @@ -1145,7 +1145,7 @@ use File::Glob qw(:case); 'Log::Message::Simple' => { 'MAINTAINER' => 'kane', - 'DISTRIBUTION' => 'BINGOS/Log-Message-Simple-0.08.tar.gz', + 'DISTRIBUTION' => 'BINGOS/Log-Message-Simple-0.10.tar.gz', 'FILES' => q[cpan/Log-Message-Simple], 'UPSTREAM' => 'cpan', }, diff --git a/cpan/Log-Message-Simple/lib/Log/Message/Simple.pm b/cpan/Log-Message-Simple/lib/Log/Message/Simple.pm index efceae5..f9db4ff 100644 --- a/cpan/Log-Message-Simple/lib/Log/Message/Simple.pm +++ b/cpan/Log-Message-Simple/lib/Log/Message/Simple.pm @@ -1,13 +1,14 @@ package Log::Message::Simple; +use if $] > 5.017, 'deprecate'; use strict; use Log::Message private => 0;; -BEGIN { - use vars qw[$VERSION]; - $VERSION = 0.08; +BEGIN { + use vars qw[$VERSION]; + $VERSION = '0.10'; } - + =pod @@ -45,7 +46,7 @@ Log::Message::Simple - Simplified interface to Log::Message local $Log::Message::Simple::MSG_FH = \*STDERR; local $Log::Message::Simple::ERROR_FH = \*STDERR; local $Log::Message::Simple::DEBUG_FH = \*STDERR; - + ### force a stacktrace on error local $Log::Message::Simple::STACKTRACE_ON_ERROR = 1 @@ -68,7 +69,7 @@ Exported by default, or using the C<:STD> tag. =head2 debug("message string" [,VERBOSE]) Records a debug message on the stack, and prints it to C<STDOUT> (or -actually C<$DEBUG_FH>, see the C<GLOBAL VARIABLES> section below), +actually C<$DEBUG_FH>, see the C<GLOBAL VARIABLES> section below), if the C<VERBOSE> option is true. The C<VERBOSE> option defaults to false. @@ -83,10 +84,10 @@ The C<VERBOSE> options defaults to true. Exported by default, or using the C<:STD> tag. -=cut +=cut { package Log::Message::Handlers; - + sub msg { my $self = shift; my $verbose = shift || 0; @@ -127,8 +128,8 @@ Exported by default, or using the C<:STD> tag. my $msg = '['. $self->tag . '] ' . $self->message; - print $Log::Message::Simple::STACKTRACE_ON_ERROR - ? Carp::shortmess($msg) + print $Log::Message::Simple::STACKTRACE_ON_ERROR + ? Carp::shortmess($msg) : $msg . "\n"; select $old_fh; @@ -197,23 +198,23 @@ BEGIN { @ISA = 'Exporter'; @EXPORT = qw[error msg debug]; @EXPORT_OK = qw[carp cluck croak confess]; - + %EXPORT_TAGS = ( STD => \@EXPORT, CARP => \@EXPORT_OK, ALL => [ @EXPORT, @EXPORT_OK ], - ); + ); my $log = new Log::Message; for my $func ( @EXPORT, @EXPORT_OK ) { no strict 'refs'; - + ### up the carplevel for the carp emulation ### functions *$func = sub { local $Carp::CarpLevel += 2 if grep { $_ eq $func } @EXPORT_OK; - + my $msg = shift; $log->store( message => $msg, @@ -265,7 +266,7 @@ printed. This default to C<*STDOUT>. =item $STACKTRACE_ON_ERROR -If this option is set to C<true>, every call to C<error()> will +If this option is set to C<true>, every call to C<error()> will generate a stacktrace using C<Carp::shortmess()>. Defaults to C<false> @@ -280,7 +281,7 @@ BEGIN { $ERROR_FH = \*STDERR; $MSG_FH = \*STDOUT; $DEBUG_FH = \*STDOUT; - + $STACKTRACE_ON_ERROR = 0; } diff --git a/cpan/Log-Message-Simple/t/02_imports.t b/cpan/Log-Message-Simple/t/02_imports.t index 4910b97..4fc22ba 100644 --- a/cpan/Log-Message-Simple/t/02_imports.t +++ b/cpan/Log-Message-Simple/t/02_imports.t @@ -9,50 +9,50 @@ my @Msg = qw[msg debug error]; ### test empty import { package Test::A; - + eval "use $Class ()"; Test::More::ok( !$@, "using $Class with no import" ); - + for my $func ( @Carp, @Msg ) { Test::More::ok( !__PACKAGE__->can( $func ), " $func not imported" ); } -} +} ### test :STD import { package Test::B; eval "use $Class ':STD'"; Test::More::ok( !$@, "using $Class with :STD import" ); - + for my $func ( @Carp ) { Test::More::ok( !__PACKAGE__->can( $func ), " $func not imported" ); } - + for my $func ( @Msg ) { Test::More::ok( __PACKAGE__->can( $func ), " $func imported" ); - } -} + } +} ### test :CARP import { package Test::C; eval "use $Class ':CARP'"; Test::More::ok( !$@, "using $Class with :CARP import" ); - + for my $func ( @Msg ) { Test::More::ok( !__PACKAGE__->can( $func ), " $func not imported" ); } - + for my $func ( @Carp ) { Test::More::ok( __PACKAGE__->can( $func ), " $func imported" ); - } -} + } +} ### test all import @@ -60,9 +60,9 @@ my @Msg = qw[msg debug error]; eval "use $Class ':ALL'"; Test::More::ok( !$@, "using $Class with :ALL import" ); - + for my $func ( @Carp, @Msg ) { Test::More::ok( __PACKAGE__->can( $func ), " $func imported" ); - } -} + } +} diff --git a/cpan/Log-Message-Simple/t/03_functions.t b/cpan/Log-Message-Simple/t/03_functions.t index 7d8a0d8..952efb9 100644 --- a/cpan/Log-Message-Simple/t/03_functions.t +++ b/cpan/Log-Message-Simple/t/03_functions.t @@ -18,7 +18,7 @@ use_ok( $Class ); ### & friends will print there for my $name (@Carp, @Msg) { no strict 'refs'; - *$name = sub { + *$name = sub { local $^W; ### do the block twice to avoid 'used only once' @@ -36,41 +36,41 @@ use_ok( $Class ); local *STDERR; local $SIG{__WARN__} = sub { }; - + my $ref = $Class->can( $name ); $ref->( @_ ); }; - } + } } for my $name (@Carp, @Msg) { - + my $ref = $Pkg->can( $name ); ok( $ref, "Found function for '$name'" ); ### start with an empty stack? cmp_ok( scalar @{[$Class->stack]}, '==', 0, " Starting with empty stack" ); - ok(!$Class->stack_as_string," Stringified stack empty" ); - + ok(!$Class->stack_as_string," Stringified stack empty" ); + ### call the func... no output should appear ### eval this -- the croak/confess functions die eval { $ref->( $Text ); }; - + my @stack = $Class->stack; cmp_ok( scalar(@stack), '==', 1, " Text logged to stack" ); - - for my $re ( $Text, quotemeta '['.uc($name).']' ) { + + for my $re ( $Text, quotemeta '['.uc($name).']' ) { like( $Class->stack_as_string, qr/$re/, " Text as expected" ); } - ### empty stack again ### + ### empty stack again ### ok( $Class->flush, " Stack flushed" ); cmp_ok( scalar @{[$Class->stack]}, '==', 0, " Starting with empty stack" ); - ok(!$Class->stack_as_string," Stringified stack empty" ); + ok(!$Class->stack_as_string," Stringified stack empty" ); } -- Perl5 Master Repository
