File Coverage

blib/lib/POE/Component/Server/Syslog.pm
Criterion Covered Total %
statement 26 28 92.8
branch 4 6 66.6
condition n/a
subroutine 7 7 100.0
pod 1 1 100.0
total 38 42 90.4


line stmt bran cond sub pod time code
1             # $Id: Syslog.pm 446 2004-12-27 00:57:57Z sungo $
2             package POE::Component::Server::Syslog;
3             $POE::Component::Server::Syslog::VERSION = '1.22';
4             #ABSTRACT: syslog services for POE
5              
6             # Docs at the end.
7              
8 2     2   205758 use 5.006001;
  2         5  
9 2     2   8 use warnings;
  2         2  
  2         62  
10 2     2   5 use strict;
  2         3  
  2         27  
11              
12 2     2   7 use POE;
  2         9  
  2         9  
13 2     2   1259 use POE::Component::Server::Syslog::TCP;
  2         4  
  2         79  
14 2     2   925 use POE::Component::Server::Syslog::UDP;
  2         3  
  2         191  
15              
16             sub spawn {
17 2     2 1 785 my $class = shift;
18 2         22 my %args = @_;
19 2         7 my $type = delete $args{Type};
20              
21 2         2 my $s;
22 2 50       7 if($type) {
23 2 100       9 if($type eq 'tcp') {
    50          
24 1         11 $s = POE::Component::Server::Syslog::TCP->spawn(
25             %args,
26             );
27             } elsif ($type eq 'udp') {
28 1         12 $s = POE::Component::Server::Syslog::UDP->spawn(
29             %args,
30             );
31             } else {
32 0         0 return undef;
33             }
34             } else {
35 0         0 $s = POE::Component::Server::Syslog::UDP->spawn(
36             %args,
37             );
38             }
39 2         13 return $s;
40             }
41              
42             1;
43              
44              
45             # sungo // vim: ts=4 sw=4 noexpandtab
46              
47             __END__