File Coverage

lib/POSIX/1003/Proc.pm
Criterion Covered Total %
statement 18 29 62.0
branch n/a
condition n/a
subroutine 6 17 35.2
pod 8 9 88.8
total 32 55 58.1


line stmt bran cond sub pod time code
1             # Copyrights 2011-2020 by [Mark Overmeer].
2             # For other contributors see ChangeLog.
3             # See the manual pages for details on the licensing terms.
4             # Pod stripped from pm file by OODoc 2.02.
5             # This code is part of distribution POSIX-1003. Meta-POD processed with
6             # OODoc into POD and HTML manual-pages. See README.md
7             # Copyright Mark Overmeer. Licensed under the same terms as Perl itself.
8              
9             package POSIX::1003::Proc;
10 3     3   72569 use vars '$VERSION';
  3         14  
  3         170  
11             $VERSION = '1.02';
12              
13 3     3   17 use base 'POSIX::1003::Module';
  3         6  
  3         616  
14              
15 3     3   20 use warnings;
  3         5  
  3         78  
16 3     3   15 use strict;
  3         18  
  3         455  
17              
18             my @constants;
19             my @functions = qw/
20             abort
21              
22             WEXITSTATUS WIFEXITED WIFSIGNALED WIFSTOPPED
23             WSTOPSIG WTERMSIG
24              
25             getpid getppid
26             _exit pause setpgid setsid tcgetpgrp tcsetpgrp
27             ctermid cuserid getcwd nice
28             /;
29              
30             our @IN_CORE = qw/wait waitpid/;
31             push @functions, @IN_CORE;
32              
33             our %EXPORT_TAGS =
34             ( constants => \@constants
35             , functions => \@functions
36             , tables => [ '%proc' ]
37             );
38              
39             my $proc;
40             our %proc;
41              
42             BEGIN {
43 3     3   53 $proc = proc_table;
44 3         26 push @constants, keys %$proc;
45 3         26 tie %proc, 'POSIX::1003::ReadOnlyTable', $proc;
46             }
47              
48              
49             # When the next where automatically imported from POSIX, they are
50             # considered constant and therefore without parameter. Therefore,
51             # these are linked explicitly.
52             *WIFEXITED = \&POSIX::WIFEXITED;
53             *WIFSIGNALED = \&POSIX::WIFSIGNALED;
54             *WIFSTOPPED = \&POSIX::WIFSTOPPED;
55             *WEXITSTATUS = \&POSIX::WEXITSTATUS;
56             *WTERMSIG = \&POSIX::WTERMSIG;
57             *WSTOPSIG = \&POSIX::WSTOPSIG;
58              
59             #-------------------------------------
60              
61 0     0 1 0 sub cuserid() {goto &POSIX::cuserid}
62 0     0 1 0 sub ctermid() {goto &POSIX::ctermid}
63 0     0   0 sub _exit($) {goto &POSIX::_exit}
64 0     0 1 0 sub pause() {goto &POSIX::pause}
65 0     0 1 0 sub setpgid($$) {goto &POSIX::setpgid}
66 0     0 1 0 sub setsid() {goto &POSIX::setsid}
67 0     0 0 0 sub cgetpgrp($) {goto &POSIX::cgetpgrp}
68 0     0 1 0 sub tcsetpgrp($$) {goto &POSIX::tcsetpgrp}
69              
70             # getpid and getppid implemented in XS
71              
72 0     0 1 0 sub nice($) {goto &POSIX::nice}
73              
74              
75 0     0 1 0 sub times5() {goto &POSIX::times}
76              
77              
78             sub _create_constant($)
79 7     7   13 { my ($class, $name) = @_;
80 7         14 my $val = $proc->{$name};
81 7     0   40 sub() {$val};
  0            
82             }
83              
84             1;