diff options
author | Chris 'BinGOs' Williams <chris@bingosnet.co.uk> | 2013-05-18 14:51:55 +0100 |
---|---|---|
committer | Ricardo Signes <rjbs@cpan.org> | 2013-05-18 15:24:52 -0400 |
commit | ac344ac5c394fb613da84b17ba3cc68182c5711e (patch) | |
tree | 01da0e12fa4299126f74d5f79244126740d18f21 | |
parent | deafb5738efe03cc6e156bd1242670519382ceab (diff) | |
download | perl-ac344ac5c394fb613da84b17ba3cc68182c5711e.tar.gz |
Removed cpan/Log-Message-Simple
-rw-r--r-- | MANIFEST | 4 | ||||
-rwxr-xr-x | Porting/Maintainers.pl | 8 | ||||
-rw-r--r-- | cpan/Log-Message-Simple/lib/Log/Message/Simple.pm | 296 | ||||
-rw-r--r-- | cpan/Log-Message-Simple/t/01_use.t | 8 | ||||
-rw-r--r-- | cpan/Log-Message-Simple/t/02_imports.t | 68 | ||||
-rw-r--r-- | cpan/Log-Message-Simple/t/03_functions.t | 76 | ||||
-rw-r--r-- | lib/.gitignore | 1 | ||||
-rw-r--r-- | t/porting/known_pod_issues.dat | 1 |
8 files changed, 1 insertions, 461 deletions
@@ -1490,10 +1490,6 @@ cpan/Log-Message/lib/Log/Message/Config.pm Log::Message cpan/Log-Message/lib/Log/Message/Handlers.pm Log::Message cpan/Log-Message/lib/Log/Message/Item.pm Log::Message cpan/Log-Message/lib/Log/Message.pm Log::Message -cpan/Log-Message-Simple/lib/Log/Message/Simple.pm Log::Simple -cpan/Log-Message-Simple/t/01_use.t Log::Simple tests -cpan/Log-Message-Simple/t/02_imports.t Log::Simple tests -cpan/Log-Message-Simple/t/03_functions.t Log::Simple tests cpan/Log-Message/t/01_Log-Message-Config.t Log::Message tests cpan/Log-Message/t/02_Log-Message.t Log::Message tests cpan/Log-Message/t/conf/config_file Log::Message tests diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl index 6c4a0ae9e9..cfaafe12c7 100755 --- a/Porting/Maintainers.pl +++ b/Porting/Maintainers.pl @@ -1103,14 +1103,6 @@ use File::Glob qw(:case); 'DEPRECATED' => '5.017009', }, - 'Log::Message::Simple' => { - 'MAINTAINER' => 'kane', - 'DISTRIBUTION' => 'BINGOS/Log-Message-Simple-0.10.tar.gz', - 'FILES' => q[cpan/Log-Message-Simple], - 'UPSTREAM' => 'cpan', - 'DEPRECATED' => '5.017009', - }, - 'mad' => { 'MAINTAINER' => 'lwall', 'FILES' => q[mad], diff --git a/cpan/Log-Message-Simple/lib/Log/Message/Simple.pm b/cpan/Log-Message-Simple/lib/Log/Message/Simple.pm deleted file mode 100644 index f9db4ffc1a..0000000000 --- a/cpan/Log-Message-Simple/lib/Log/Message/Simple.pm +++ /dev/null @@ -1,296 +0,0 @@ -package Log::Message::Simple; -use if $] > 5.017, 'deprecate'; - -use strict; -use Log::Message private => 0;; - -BEGIN { - use vars qw[$VERSION]; - $VERSION = '0.10'; -} - - -=pod - -=head1 NAME - -Log::Message::Simple - Simplified interface to Log::Message - -=head1 SYNOPSIS - - use Log::Message::Simple qw[msg error debug - carp croak cluck confess]; - - use Log::Message::Simple qw[:STD :CARP]; - - ### standard reporting functionality - msg( "Connecting to database", $verbose ); - error( "Database connection failed: $@", $verbose ); - debug( "Connection arguments were: $args", $debug ); - - ### standard carp functionality - carp( "Wrong arguments passed: @_" ); - croak( "Fatal: wrong arguments passed: @_" ); - cluck( "Wrong arguments passed -- including stacktrace: @_" ); - confess("Fatal: wrong arguments passed -- including stacktrace: @_" ); - - ### retrieve individual message - my @stack = Log::Message::Simple->stack; - my @stack = Log::Message::Simple->flush; - - ### retrieve the entire stack in printable form - my $msgs = Log::Message::Simple->stack_as_string; - my $trace = Log::Message::Simple->stack_as_string(1); - - ### redirect output - 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 - -=head1 DESCRIPTION - -This module provides standardized logging facilities using the -C<Log::Message> module. - -=head1 FUNCTIONS - -=head2 msg("message string" [,VERBOSE]) - -Records a message on the stack, and prints it to C<STDOUT> (or actually -C<$MSG_FH>, see the C<GLOBAL VARIABLES> section below), if the -C<VERBOSE> option is true. -The C<VERBOSE> option defaults to false. - -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), -if the C<VERBOSE> option is true. -The C<VERBOSE> option defaults to false. - -Exported by default, or using the C<:STD> tag. - -=head2 error("error string" [,VERBOSE]) - -Records an error on the stack, and prints it to C<STDERR> (or actually -C<$ERROR_FH>, see the C<GLOBAL VARIABLES> sections below), if the -C<VERBOSE> option is true. -The C<VERBOSE> options defaults to true. - -Exported by default, or using the C<:STD> tag. - -=cut - -{ package Log::Message::Handlers; - - sub msg { - my $self = shift; - my $verbose = shift || 0; - - ### so you don't want us to print the msg? ### - return if defined $verbose && $verbose == 0; - - my $old_fh = select $Log::Message::Simple::MSG_FH; - print '['. $self->tag (). '] ' . $self->message . "\n"; - select $old_fh; - - return; - } - - sub debug { - my $self = shift; - my $verbose = shift || 0; - - ### so you don't want us to print the msg? ### - return if defined $verbose && $verbose == 0; - - my $old_fh = select $Log::Message::Simple::DEBUG_FH; - print '['. $self->tag (). '] ' . $self->message . "\n"; - select $old_fh; - - return; - } - - sub error { - my $self = shift; - my $verbose = shift; - $verbose = 1 unless defined $verbose; # default to true - - ### so you don't want us to print the error? ### - return if defined $verbose && $verbose == 0; - - my $old_fh = select $Log::Message::Simple::ERROR_FH; - - my $msg = '['. $self->tag . '] ' . $self->message; - - print $Log::Message::Simple::STACKTRACE_ON_ERROR - ? Carp::shortmess($msg) - : $msg . "\n"; - - select $old_fh; - - return; - } -} - -=head2 carp(); - -Provides functionality equal to C<Carp::carp()> while still logging -to the stack. - -Exported by using the C<:CARP> tag. - -=head2 croak(); - -Provides functionality equal to C<Carp::croak()> while still logging -to the stack. - -Exported by using the C<:CARP> tag. - -=head2 confess(); - -Provides functionality equal to C<Carp::confess()> while still logging -to the stack. - -Exported by using the C<:CARP> tag. - -=head2 cluck(); - -Provides functionality equal to C<Carp::cluck()> while still logging -to the stack. - -Exported by using the C<:CARP> tag. - -=head1 CLASS METHODS - -=head2 Log::Message::Simple->stack() - -Retrieves all the items on the stack. Since C<Log::Message::Simple> is -implemented using C<Log::Message>, consult its manpage for the -function C<retrieve> to see what is returned and how to use the items. - -=head2 Log::Message::Simple->stack_as_string([TRACE]) - -Returns the whole stack as a printable string. If the C<TRACE> option is -true all items are returned with C<Carp::longmess> output, rather than -just the message. -C<TRACE> defaults to false. - -=head2 Log::Message::Simple->flush() - -Removes all the items from the stack and returns them. Since -C<Log::Message::Simple> is implemented using C<Log::Message>, consult its -manpage for the function C<retrieve> to see what is returned and how -to use the items. - -=cut - -BEGIN { - use Exporter; - use Params::Check qw[ check ]; - use vars qw[ @EXPORT @EXPORT_OK %EXPORT_TAGS @ISA ];; - - @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, - tag => uc $func, - level => $func, - extra => [@_] - ); - }; - } - - sub flush { - return reverse $log->flush; - } - - sub stack { - return $log->retrieve( chrono => 1 ); - } - - sub stack_as_string { - my $class = shift; - my $trace = shift() ? 1 : 0; - - return join $/, map { - '[' . $_->tag . '] [' . $_->when . '] ' . - ($trace ? $_->message . ' ' . $_->longmess - : $_->message); - } __PACKAGE__->stack; - } -} - -=head1 GLOBAL VARIABLES - -=over 4 - -=item $ERROR_FH - -This is the filehandle all the messages sent to C<error()> are being -printed. This defaults to C<*STDERR>. - -=item $MSG_FH - -This is the filehandle all the messages sent to C<msg()> are being -printed. This default to C<*STDOUT>. - -=item $DEBUG_FH - -This is the filehandle all the messages sent to C<debug()> are being -printed. This default to C<*STDOUT>. - -=item $STACKTRACE_ON_ERROR - -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> - -=back - -=cut - -BEGIN { - use vars qw[ $ERROR_FH $MSG_FH $DEBUG_FH $STACKTRACE_ON_ERROR ]; - - local $| = 1; - $ERROR_FH = \*STDERR; - $MSG_FH = \*STDOUT; - $DEBUG_FH = \*STDOUT; - - $STACKTRACE_ON_ERROR = 0; -} - - -1; - -# Local variables: -# c-indentation-style: bsd -# c-basic-offset: 4 -# indent-tabs-mode: nil -# End: -# vim: expandtab shiftwidth=4: diff --git a/cpan/Log-Message-Simple/t/01_use.t b/cpan/Log-Message-Simple/t/01_use.t deleted file mode 100644 index 147347c240..0000000000 --- a/cpan/Log-Message-Simple/t/01_use.t +++ /dev/null @@ -1,8 +0,0 @@ -use Test::More 'no_plan'; -use strict; - -my $Class = 'Log::Message::Simple'; - -use_ok( $Class ); - -diag( "Testing $Class version " . $Class->VERSION ) unless $ENV{PERL_CORE}; diff --git a/cpan/Log-Message-Simple/t/02_imports.t b/cpan/Log-Message-Simple/t/02_imports.t deleted file mode 100644 index 4fc22ba4ec..0000000000 --- a/cpan/Log-Message-Simple/t/02_imports.t +++ /dev/null @@ -1,68 +0,0 @@ -use Test::More 'no_plan'; -use strict; - -my $Class = 'Log::Message::Simple'; -my @Carp = qw[carp croak cluck confess]; -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 - -{ package Test::D; - - 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 deleted file mode 100644 index 952efb9aae..0000000000 --- a/cpan/Log-Message-Simple/t/03_functions.t +++ /dev/null @@ -1,76 +0,0 @@ -use Test::More 'no_plan'; -use strict; - -my $Class = 'Log::Message::Simple'; -my @Carp = qw[carp croak cluck confess]; -my @Msg = qw[msg debug error]; -my $Text = 'text'; -my $Pkg = 'Test::A'; - -use_ok( $Class ); - -{ package Test::A; - - ### set up local equivalents to exported functions - ### so we can print to closed FH without having to worry - ### about warnings - ### close stderr/warnings for that same purpose, as carp - ### & friends will print there - for my $name (@Carp, @Msg) { - no strict 'refs'; - *$name = sub { - local $^W; - - ### do the block twice to avoid 'used only once' - ### warnings - local $Log::Message::Simple::ERROR_FH; - local $Log::Message::Simple::DEBUG_FH; - local $Log::Message::Simple::MSG_FH; - - local $Log::Message::Simple::ERROR_FH; - local $Log::Message::Simple::DEBUG_FH; - local $Log::Message::Simple::MSG_FH; - - - - - 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" ); - - ### 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).']' ) { - like( $Class->stack_as_string, qr/$re/, - " Text as expected" ); - } - - ### 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" ); -} diff --git a/lib/.gitignore b/lib/.gitignore index 390f4331c8..78ef1fbd0e 100644 --- a/lib/.gitignore +++ b/lib/.gitignore @@ -196,7 +196,6 @@ /Log/Message/Config.pm /Log/Message/Handlers.pm /Log/Message/Item.pm -/Log/Message/Simple.pm /MIME /Math /Math/BigFloat diff --git a/t/porting/known_pod_issues.dat b/t/porting/known_pod_issues.dat index 18b27cf579..fdc5a4f780 100644 --- a/t/porting/known_pod_issues.dat +++ b/t/porting/known_pod_issues.dat @@ -74,6 +74,7 @@ IPC::Signal kill(3) langinfo(3) Lingua::KO::Hangul::Util +Log::Message::Simple local::lib Mail::Send man(5) |