blib/lib/MYDan/Util/MIO.pm untested

filter: Statementstmt 0.0% 0 / 26 Branchbran 0.0% 0 / 10 Conditioncond 0.0% 0 / 9 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 53 CC 6 SCAR 24.2
CC
6
Cov
0%
net
20.0
cmd
12.0
BEGIN
2.0
CRAP 11.3
1 package MYDan::Util::MIO;
2  
3 =head1 NAME
4  
5 MYDan::Util::MIO - Interface for MYDan::Util::MIO modules
6  
7 =cut
8 use strict;
9 use warnings;
10  
11 use Carp;
12 use File::Spec;
13  
14 our %RUN = ( max => 128, timeout => 300, log => \*STDERR );
15 our %MAX = ( buffer => 1024 * 16, period => 0.01 );
16  
17 sub net
18 {
19 my ( $class, %self ) = shift;
20  
21 for my $node ( @_ )
22 {
23 confess "duplicate addr: $node" if $self{$node};
24 $self{$node} = $node =~ /^[^:]+:\d+$/o
25 ? 1 : File::Spec->file_name_is_absolute( $node )
26 ? 0 : confess "$node: invalid unix domain socket";
27 }
28  
29 bless \%self, ref $class || $class;
30 }
31  
32 sub cmd
33 {
34 my ( $class, %self, %cmd ) = splice @_;
35  
36 while ( my ( $node, $cmd ) = each %self )
37 {
38 confess "command undefined for $node" unless $cmd;
39 $self{$node} = $cmd{$cmd} ||= ref $cmd ? $cmd : [ $cmd ];
40 }
41  
42 bless \%self, ref $class || $class;
43 }
44  
45 1;