blib/lib/IO/FD.pm

filter: Statementstmt 68.6% 35 / 51 Branchbran 12.5% 1 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 72.7% 8 / 11 Podpod 0.0% 0 / 1 totaltotal 61.9% 44 / 71 CC 5 SCAR 12.2
CC
5
Cov
61%
AUTOLOAD
8.2
fileno
6.0
BEGIN
2.7
CRAP 3.4
« blib/lib/IO/FD/DWIM.pm ↑ Summary const-c.inc »
1 package IO::FD;
2  
3 21 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 21 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 21 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 21 require Exporter;
8 21 ▶use AutoLoader;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 21 our @ISA = qw(Exporter);
11  
12 # Items to export into callers namespace by default. Note: do not export
13 # names by default without a very good reason. Use EXPORT_OK instead.
14 # Do not simply export all your public functions/methods/constants.
15  
16 # This allows declaration use IO::FD ':all';
17 # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
18 # will save memory.
19 21 our %EXPORT_TAGS = ( 'all' => [ qw(
20 accept
21 accept_multiple
22 listen
23 socket
24 bind
25 connect
26  
27 sysopen
28 sysopen4
29 close
30  
31 sysread
32 sysread4
33  
34 syswrite
35 syswrite2
36 syswrite3
37 syswrite4
38  
39 pread
40 pwrite
41  
42 mkfifo
43 mkfifoat
44  
45 pipe
46 socketpair
47 sysseek
48  
49 dup
50 dup2
51  
52 fcntl
53 ioctl
54  
55 getsockopt
56 setsockopt
57 select
58 poll
59  
60 mkstemp
61 mktemp
62  
63 readline
64 fileno
65 ) ] );
66  
67 21 our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
68  
69 21 our @EXPORT = qw(
70
71 );
72  
73 21 our $VERSION = 'v0.3.1';
74  
75 21 ▶use constant();
Subroutine BEGIN: called CC=1 SCAR=0.0
76 21 ▶use Socket qw<SOCK_NONBLOCK SOCK_CLOEXEC>;
Subroutine BEGIN: called CC=1 SCAR=0.0
77 21 my $non_block;
78 my $cloexec;
79 #Define constants for non linux systems (looked up from a ubuntu machine...)
80 BEGIN {
81 21 ▶ if($^O =~ /darwin/i){
Subroutine BEGIN: called CC=2 SCAR=9.9
Branch: 1 branch
BranchTrueFalseTotal
if ($^O =~ /darwin/i) { } 0 21 21
82 #Make belive values
83 0 $cloexec=0x10000000;
84 0 $non_block=0x20000000;
85 0 constant->import(SOCK_NONBLOCK=> $non_block);
86 0 constant->import(SOCK_CLOEXEC=> $cloexec);
87 }
88 else {
89 21 $cloexec=0;
90 21 $non_block=0;
91 }
92 }
93  
94  
95  
96 sub fileno :prototype($) {
97 0 ▶ ref($_[0])
Subroutine fileno: not called CC=2 SCAR=17.9
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] ? : 0 0 0
98 ?fileno $_[0]
99 : $_[0];
100 }
101  
102 sub AUTOLOAD {
103 # This AUTOLOAD is used to 'autoload' constants from the constant()
104 # XS function.
105  
106 0 ▶ my $constname;
Subroutine AUTOLOAD: not called CC=3 SCAR=21.1
107 0 our $AUTOLOAD;
108 0 ($constname = $AUTOLOAD) =~ s/.*:://;
109 0 ▶ croak "&IO::FD::constant not defined" if $constname eq 'constant';
Branch: 1 branch
BranchTrueFalseTotal
if $constname eq "constant" 0 0 0
110 0 my ($error, $val) = constant($constname);
111 0 ▶ if ($error) { croak $error; }
Branch: 1 branch
BranchTrueFalseTotal
if ($error) 0 0 0
112 {
113 21 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.2
114 # Fixed between 5.005_53 and 5.005_61
115 #XXX if ($] >= 5.00561) {
116 #XXX *$AUTOLOAD = sub () { $val };
117 #XXX }
118 #XXX else {
119 0 ▶ *$AUTOLOAD = sub { $val };
Subroutine __ANON__: not called CC=1 SCAR=6.9
120 #XXX }
121 }
122 0 goto &$AUTOLOAD;
123 }
124  
125 21 require XSLoader;
126 21 XSLoader::load('IO::FD', $VERSION);
127  
128 # Preloaded methods go here.
129  
130 # Autoload methods go after =cut, and are processed by the autosplit program.
131  
132 21 1;
133 __END__
« blib/lib/IO/FD/DWIM.pm ↑ Summary const-c.inc »