File Coverage

blib/lib/Sub/Todo.pm
Criterion Covered Total %
statement 26 28 92.8
branch 2 4 50.0
condition n/a
subroutine 10 12 83.3
pod 5 5 100.0
total 43 49 87.7


line stmt bran cond sub pod time code
1             package Sub::Todo;
2              
3 1     1   40013 use warnings;
  1         2  
  1         38  
4 1     1   6 use strict;
  1         2  
  1         36  
5 1     1   5 use Carp;
  1         5  
  1         93  
6              
7 1     1   1045 use version; our $VERSION = qv('0.0.3');
  1         2775  
  1         8  
8              
9 1     1   98 use base qw(Exporter);
  1         2  
  1         375  
10             our @EXPORT = qw(todo);
11             our @EXPORT_OK = qw(todo_return todo_carp todo_croak get_errno_func_not_impl);
12             our %EXPORT_TAGS = ( 'all' => [@EXPORT, @EXPORT_OK], 'long' => \@EXPORT_OK );
13              
14             sub todo {
15 1     1 1 230 $! = get_errno_func_not_impl(), return;
16             }
17              
18             sub todo_return {
19 0     0 1 0 $! = get_errno_func_not_impl(), return;
20             }
21              
22             sub todo_carp {
23             # $! = 78, warn($!), return;
24 1     1 1 3 $! = get_errno_func_not_impl(), carp("$!"), $! = get_errno_func_not_impl(), return; # carp/croak needs the double quotes and double assignment of $!, warn/die does not, weird...
25             }
26              
27             sub todo_croak {
28             # $! = 78, die($!), return;
29 0     0 1 0 $! = get_errno_func_not_impl(), croak("$!"), $! = get_errno_func_not_impl(), return; # still 'return;' just in case they've overidden croak()/handlers with funny things
30             }
31              
32             sub get_errno_func_not_impl {
33             # we don't want to load POSIX but if its there we want to use it
34             # CONSTANTs are weird when not defined so we have to:
35              
36 4     4 1 14 local $^W = 0;
37 1     1   7 no warnings;
  1         2  
  1         47  
38 1     1   6 no strict;
  1         2  
  1         99  
39 4         5 my $posix = POSIX::ENOSYS;
40 4 50       245 return $posix ne 'POSIX::ENOSYS' ? POSIX::ENOSYS
    50          
41             : $^O =~ /linux/i ? 38
42             : 78
43             ;
44             }
45              
46             1;
47              
48             __END__