Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor ::Fast-specific constants and tests
- Loading branch information
Showing
13 changed files
with
249 additions
and
356 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,4 @@ MYMETA.* | |
*.old | ||
Fast.c | ||
const-*.inc | ||
*.swp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package Log::Syslog::Fast::Constants; | ||
|
||
use strict; | ||
use warnings; | ||
|
||
use Log::Syslog::Constants (); | ||
use Carp 'croak'; | ||
|
||
require Exporter; | ||
our @ISA = qw(Exporter); | ||
|
||
# protocols | ||
use constant LOG_UDP => 0; # UDP | ||
use constant LOG_TCP => 1; # TCP | ||
use constant LOG_UNIX => 2; # UNIX socket | ||
|
||
# formats | ||
use constant LOG_RFC3164 => 0; | ||
use constant LOG_RFC5424 => 1; | ||
|
||
our @EXPORT = (); | ||
our %EXPORT_TAGS = ( | ||
protos => [qw/ LOG_TCP LOG_UDP LOG_UNIX /], | ||
formats => [qw/ LOG_RFC3164 LOG_RFC5424 /], | ||
); | ||
$EXPORT_TAGS{$_} = $Log::Syslog::Constants::EXPORT_TAGS{$_} | ||
for qw(facilities severities); | ||
our @EXPORT_OK = @{ $EXPORT_TAGS{all} } = map {@$_} values %EXPORT_TAGS; | ||
|
||
sub AUTOLOAD { | ||
(my $meth = our $AUTOLOAD) =~ s/.*:://; | ||
if (Log::Syslog::Constants->can($meth)) { | ||
return Log::Syslog::Constants->$meth(@_); | ||
} | ||
croak "Undefined subroutine $AUTOLOAD"; | ||
} | ||
|
||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,9 @@ | ||
use Test::More tests => 1; | ||
|
||
use IO::Socket::INET; | ||
|
||
eval { | ||
$CLASS->new(LOG_UNIX, 'a' x 10000, 0, LOG_LOCAL0, LOG_INFO, "mymachine", "logger"); | ||
}; | ||
like($@, qr/^Error in ->new/, "long filename"); | ||
|
||
# vim: filetype=perl | ||
1; | ||
1; |
Oops, something went wrong.