diff options
author | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2006-01-09 13:44:20 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2006-01-09 13:44:20 +0000 |
commit | 04f98b2924420f2d5dda20af9ff8971605fd60d2 (patch) | |
tree | d0301524577809a58603feef772d5e279aacfea6 | |
parent | 9f2e35140733c7b8f4ab179f11bf740ca3d2130e (diff) | |
download | perl-04f98b2924420f2d5dda20af9ff8971605fd60d2.tar.gz |
Upgrade to Sys::Syslog 0.12
p4raw-id: //depot/perl@26752
-rw-r--r-- | ext/Sys/Syslog/Changes | 11 | ||||
-rw-r--r-- | ext/Sys/Syslog/README | 7 | ||||
-rw-r--r-- | ext/Sys/Syslog/Syslog.pm | 6 | ||||
-rw-r--r-- | ext/Sys/Syslog/t/constants.t | 61 | ||||
-rw-r--r-- | ext/Sys/Syslog/t/podspell.t | 1 |
5 files changed, 46 insertions, 40 deletions
diff --git a/ext/Sys/Syslog/Changes b/ext/Sys/Syslog/Changes index a2ee1f80ff..fb7f83cde7 100644 --- a/ext/Sys/Syslog/Changes +++ b/ext/Sys/Syslog/Changes @@ -1,7 +1,16 @@ Revision history for Sys-Syslog +0.12 2006.01.07 + [CODE] Merged some modifications from bleadperl. + [DOC] Added a link to an article about Sys::Syslog. + [TESTS] Removed optional dependency on Test::Exception. + [TESTS] Improved t/constant.t + [TESTS] Rewrote t/constants.t because future versions of + ExtUtils::Constant will prevent the constant() function from + being directly called. + 0.11 2005.12.28 - [BUGFIX] setlogmask() now behaves liek its C counterpart. + [BUGFIX] setlogmask() now behaves like its C counterpart. [CODE] Can now export and use the macros. [CODE] Support for three Exporter tags. [CODE] XSLoader is now optional. diff --git a/ext/Sys/Syslog/README b/ext/Sys/Syslog/README index 2456652e67..0d468645ee 100644 --- a/ext/Sys/Syslog/README +++ b/ext/Sys/Syslog/README @@ -26,7 +26,7 @@ INSTALLATION - Linux 2.6, gcc 3.4.1 - FreeBSD 4.7, gcc 2.95.4 - - Mac OS X 10.2.6, gcc 3.1 + - Mac OS X 10.4, gcc 4.0.1 Sys::Syslog should on any Perl since 5.6.0. This module has been tested by the author to check that it works with the following @@ -36,11 +36,10 @@ INSTALLATION - Perl 5.8.5 i386-linux-thread-multi (vendor build) - Perl 5.6.1 i386-freebsd (custom build) - Perl 5.8.7 i386-freebsd (custom build) - - Perl 5.6.0 darwin (vendor build) - - Perl 5.8.7 cygwin-thread-multi-64int (vendor build) + - Perl 5.8.6 darwin-thread-multi-2level (vendor build) See also the corresponding CPAN Testers page: - http://testers.cpan.org/show/Net-Pcap.html + http://testers.cpan.org/show/Sys-Syslog.html SUPPORT AND DOCUMENTATION diff --git a/ext/Sys/Syslog/Syslog.pm b/ext/Sys/Syslog/Syslog.pm index 6bdb3b9197..d47b1f73da 100644 --- a/ext/Sys/Syslog/Syslog.pm +++ b/ext/Sys/Syslog/Syslog.pm @@ -4,7 +4,7 @@ use Carp; require 5.006; require Exporter; -our $VERSION = '0.11'; +our $VERSION = '0.12'; our @ISA = qw(Exporter); our %EXPORT_TAGS = ( @@ -53,7 +53,7 @@ Sys::Syslog - Perl interface to the UNIX syslog(3) calls =head1 VERSION -Version 0.11 +Version 0.12 =head1 SYNOPSIS @@ -436,6 +436,8 @@ was unable to find an appropriate an appropriate device. L<syslog(3)> +I<Syslogging with Perl>, L<http://lexington.pm.org/meetings/022001.html> + =head1 AUTHOR diff --git a/ext/Sys/Syslog/t/constants.t b/ext/Sys/Syslog/t/constants.t index 061d018a26..11950687b2 100644 --- a/ext/Sys/Syslog/t/constants.t +++ b/ext/Sys/Syslog/t/constants.t @@ -1,46 +1,41 @@ #!/usr/bin/perl -T use strict; +use File::Spec; use Test::More; -my @names; -BEGIN { - if(open(MACROS, 'macros.all')) { - @names = map {chomp;$_} <MACROS>; - close(MACROS); - plan tests => @names + 3; - } else { - plan skip_all => "can't read 'macros.all': $!" - } -} -use Sys::Syslog; -eval "use Test::Exception"; my $has_test_exception = !$@; +my $macrosall = $ENV{PERL_CORE} ? File::Spec->catfile(qw(.. ext Sys Syslog macros.all)) + : 'macros.all'; +open(MACROS, $macrosall) or plan skip_all => "can't read '$macrosall': $!"; +my @names = map {chomp;$_} <MACROS>; +close(MACROS); +plan tests => @names * 2 + 2; -# Testing error messages -SKIP: { - skip "Test::Exception not available", 1 unless $has_test_exception; - - # constant() errors - throws_ok(sub { - Sys::Syslog::constant() - }, '/^Usage: Sys::Syslog::constant\(sv\)/', - "calling constant() with no argument"); -} +my $callpack = my $testpack = 'Sys::Syslog'; +eval "use $callpack"; -# Testing constant() -like( Sys::Syslog::constant('This'), - '/^This is not a valid Sys::Syslog macro/', - "calling constant() with a non existing name" ); +eval "${callpack}::This()"; +like( $@, "/^This is not a valid $testpack macro/", "trying a non-existing macro"); -like( Sys::Syslog::constant('NOSUCHNAME'), - '/^NOSUCHNAME is not a valid Sys::Syslog macro/', - "calling constant() with a non existing name" ); +eval "${callpack}::NOSUCHNAME()"; +like( $@, "/^NOSUCHNAME is not a valid $testpack macro/", "trying a non-existing macro"); # Testing all macros if(@names) { for my $name (@names) { - like( Sys::Syslog::constant($name), - '/^(?:\d+|Your vendor has not defined Sys::Syslog macro '.$name.', used)$/', - "checking that $name is a number (".Sys::Syslog::constant($name).")" ); + SKIP: { + $name =~ /^(\w+)$/ or skip "invalid name '$name'", 2; + $name = $1; + my $v = eval "${callpack}::$name()"; + + if($v =~ /^\d+$/) { + is( $@, '', "calling the constant $name as a function" ); + like( $v, '/^\d+$/', "checking that $name is a number ($v)" ); + + } else { + like( $@, "/^Your vendor has not defined $testpack macro $name/", + "calling the constant via its name" ); + skip "irrelevant test in this case", 1 + } + } } } - diff --git a/ext/Sys/Syslog/t/podspell.t b/ext/Sys/Syslog/t/podspell.t index 25828a4de0..ac285124b3 100644 --- a/ext/Sys/Syslog/t/podspell.t +++ b/ext/Sys/Syslog/t/podspell.t @@ -53,4 +53,5 @@ Failover logopts pathname syslogd +Syslogging logmask |