| 1 | package POSIX::2008; | ||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||
| 3 | 11 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 4 | 11 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||
| 6 | 11 | ▶ | use Carp (); | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 7 | 11 | ▶ | use IO::Dir (); | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 8 | 11 | ▶ | use IO::File (); | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 9 | 11 | ▶ | use XSLoader (); | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||
| 11 | 11 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 12 | 11 | our $VERSION = '0.30'; | |||||||||||||||||||||||||||||||||||||
| 13 | 11 | our $XS_VERSION = $VERSION; | |||||||||||||||||||||||||||||||||||||
| 14 | 11 | $VERSION = eval $VERSION; # so "use Module 0.002" won't warn on underscore | |||||||||||||||||||||||||||||||||||||
| 15 | 11 | XSLoader::load('POSIX::2008', $XS_VERSION); | |||||||||||||||||||||||||||||||||||||
| 16 | } | ||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||
| 18 | 11 | require Exporter; | |||||||||||||||||||||||||||||||||||||
| 19 | 11 | require 'POSIX/2008/symbols.pl'; # Get @_constants and @_functions. | |||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||
| 21 | 11 | our @_constants; | |||||||||||||||||||||||||||||||||||||
| 22 | 11 | our @_functions; | |||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||
| 24 | 11 | our @ISA = 'Exporter'; | |||||||||||||||||||||||||||||||||||||
| 25 | 11 | our @EXPORT = (); | |||||||||||||||||||||||||||||||||||||
| 26 | 11 | our @EXPORT_OK = (@_functions, @_constants); | |||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||
| 28 | 11 | ▶ | our %EXPORT_TAGS = ( | ||||||||||||||||||||||||||||||||||||
|
Condition100%6/6
/at2?$/ && !/^(?:creat|lstat|stat)$/
/^(?:AF|MSG|SCM|SHUT|SO|SOCK|SOL)_/ || /^SOMAXCONN$/
MC/DC100%2/2
/at2?$/ && !/^(?:creat|lstat|stat)$/
/at2?$/
!/^(?:creat|lstat|stat)$/
MC/DC100%2/2
/^(?:AF|MSG|SCM|SHUT|SO|SOCK|SOL)_/ || /^SOMAXCONN$/
/^(?:AF|MSG|SCM|SHUT|SO|SOCK|SOL)_/
/^SOMAXCONN$/
Truth table100%3/3
A && not(B)
A= /at2?$/B= !/^(?:creat|lstat|stat)$/
Truth table100%3/3
A || B
A= /^(?:AF|MSG|SCM|SHUT|SO|SOCK|SOL)_/B= /^SOMAXCONN$/
| |||||||||||||||||||||||||||||||||||||||
| 29 | # at: Older Perls lack variable length lookbehind, thus two regexen | ||||||||||||||||||||||||||||||||||||||
| 30 | # for functions. | ||||||||||||||||||||||||||||||||||||||
| 31 | 'at' => [ | ||||||||||||||||||||||||||||||||||||||
| 32 | grep(/^(?:AT|RENAME|RESOLVE)_/, @_constants), | ||||||||||||||||||||||||||||||||||||||
| 33 | grep(/at2?$/ && !/^(?:creat|lstat|stat)$/, @_functions), | ||||||||||||||||||||||||||||||||||||||
| 34 | ], | ||||||||||||||||||||||||||||||||||||||
| 35 | 'id' => [grep /^[gs]et.+id$/, @_functions], | ||||||||||||||||||||||||||||||||||||||
| 36 | 'is' => [grep /^is/, @_functions], | ||||||||||||||||||||||||||||||||||||||
| 37 | 'rw' => [grep /^(?:read|write)v?$/, @_functions], | ||||||||||||||||||||||||||||||||||||||
| 38 | 'prw' => [grep /^(?:pread|pwrite)(?:v2?)?$/, @_functions], | ||||||||||||||||||||||||||||||||||||||
| 39 | 'clock' => [ | ||||||||||||||||||||||||||||||||||||||
| 40 | grep(/^(?:CLOCK_|TIMER_ABSTIME)/, @_constants), | ||||||||||||||||||||||||||||||||||||||
| 41 | grep(/^clock/, @_functions), | ||||||||||||||||||||||||||||||||||||||
| 42 | ], | ||||||||||||||||||||||||||||||||||||||
| 43 | 'errno_h'=> [grep /^E(?!MPTY)[A-Z]+$/, @_constants], | ||||||||||||||||||||||||||||||||||||||
| 44 | 'fcntl' => [grep /^(?:[ORWX]|F|FD|POSIX_FADV|SEEK)_/, @_constants], | ||||||||||||||||||||||||||||||||||||||
| 45 | 'fenv_h' => [grep(/^FE_/, @_constants), grep (/^fe/, @_functions)], | ||||||||||||||||||||||||||||||||||||||
| 46 | 'fnm' => [grep(/^FNM_/, @_constants), grep(/^fnmatch$/, @_functions)], | ||||||||||||||||||||||||||||||||||||||
| 47 | 'poll' => [ | ||||||||||||||||||||||||||||||||||||||
| 48 | grep(/^(?:POLL|INFTIM)/, @_constants), | ||||||||||||||||||||||||||||||||||||||
| 49 | grep(/^(?:poll|ppoll)$/, @_functions), | ||||||||||||||||||||||||||||||||||||||
| 50 | ], | ||||||||||||||||||||||||||||||||||||||
| 51 | 'socket_h' => [ | ||||||||||||||||||||||||||||||||||||||
| 52 | grep(/^(?:AF|MSG|SCM|SHUT|SO|SOCK|SOL)_/ || /^SOMAXCONN$/, @_constants), | ||||||||||||||||||||||||||||||||||||||
| 53 | ], | ||||||||||||||||||||||||||||||||||||||
| 54 | 'stat_h' => [grep /^(?:S_I|UTIME_)/, @_constants], | ||||||||||||||||||||||||||||||||||||||
| 55 | 'time_h' => [grep /^(?:CLOCK|TIMER)_/, @_constants], | ||||||||||||||||||||||||||||||||||||||
| 56 | 'timer' => [grep(/^TIMER_/, @_constants), grep(/^timer_/, @_functions)], | ||||||||||||||||||||||||||||||||||||||
| 57 | 'utmpx_h' => [ | ||||||||||||||||||||||||||||||||||||||
| 58 | grep(/_(?:TIME|PROCESS)$/, @_constants), | ||||||||||||||||||||||||||||||||||||||
| 59 | grep(/^(?:ACCOUNTING|EMPTY|RUN_LVL|UT_UNKNOWN)$/, @_constants), | ||||||||||||||||||||||||||||||||||||||
| 60 | grep(/utx/, @_functions), | ||||||||||||||||||||||||||||||||||||||
| 61 | ], | ||||||||||||||||||||||||||||||||||||||
| 62 | 'confstr' => [grep(/^confstr$/, @_functions), grep(/^_CS_/, @_constants)], | ||||||||||||||||||||||||||||||||||||||
| 63 | 'pathconf' => [grep(/^pathconf$/, @_functions), grep(/^_PC_/, @_constants)], | ||||||||||||||||||||||||||||||||||||||
| 64 | 'sysconf' => [grep(/^sysconf$/, @_functions), grep(/^_SC_/, @_constants)], | ||||||||||||||||||||||||||||||||||||||
| 65 | ); | ||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||
| 67 | 11 | my %deprecated = ( | |||||||||||||||||||||||||||||||||||||
| 68 | atol => 'atoi', | ||||||||||||||||||||||||||||||||||||||
| 69 | atoll => 'atoi', | ||||||||||||||||||||||||||||||||||||||
| 70 | ldiv => 'div', | ||||||||||||||||||||||||||||||||||||||
| 71 | lldiv => 'div', | ||||||||||||||||||||||||||||||||||||||
| 72 | fchdir => 'chdir', | ||||||||||||||||||||||||||||||||||||||
| 73 | fchmod => 'chmod', | ||||||||||||||||||||||||||||||||||||||
| 74 | fchown => 'chown', | ||||||||||||||||||||||||||||||||||||||
| 75 | ftruncate => 'truncate', | ||||||||||||||||||||||||||||||||||||||
| 76 | ); | ||||||||||||||||||||||||||||||||||||||
| 77 | 11 | my %deprecated_warned; | |||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||
| 79 | 11 | push @EXPORT_OK, keys %deprecated; | |||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||
| 81 | 11 | our $AUTOLOAD; | |||||||||||||||||||||||||||||||||||||
| 82 | 0 | ▶ | sub AUTOLOAD { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
AUTOLOAD: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||
| 83 | 0 | my ($func) = ($AUTOLOAD =~ /.*::(.*)/); | |||||||||||||||||||||||||||||||||||||
| 84 | 0 | ▶ | die "POSIX::2008.xs has failed to load\n" if $func eq 'constant'; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 85 | 0 | constant($func); | |||||||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||
| 88 | 11 | ▶ | sub import { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
import: called CC=2 SCAR=7.4
| |||||||||||||||||||||||||||||||||||||||
| 89 | 11 | my $this = shift; | |||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||
| 91 | 11 | ▶ | while (my ($func, $repl) = each %deprecated) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 92 | 88 | my $pkg_func = __PACKAGE__."::${func}"; | |||||||||||||||||||||||||||||||||||||
| 93 | 88 | my $pkg_repl = __PACKAGE__."::${repl}"; | |||||||||||||||||||||||||||||||||||||
| 94 | 11 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 95 | 88 | ▶ | *{$pkg_func} = sub { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=14.6
| |||||||||||||||||||||||||||||||||||||||
| 96 | Carp::carp( | ||||||||||||||||||||||||||||||||||||||
| 97 | "${pkg_func}() is deprecated, use ${pkg_repl}() instead" | ||||||||||||||||||||||||||||||||||||||
| 98 | 0 | ▶ | ) unless $deprecated_warned{$func}++; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 99 | 0 | &{$pkg_repl}; | |||||||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||||||
| 101 | 88 | } | |||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||
| 103 | 11 | __PACKAGE__->export_to_level(1, $this, @_); | |||||||||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||
| 106 | 11 | 1; | |||||||||||||||||||||||||||||||||||||