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::Pathconf; |
10
|
3
|
|
|
3
|
|
72201
|
use vars '$VERSION'; |
|
3
|
|
|
|
|
17
|
|
|
3
|
|
|
|
|
181
|
|
11
|
|
|
|
|
|
|
$VERSION = '1.02'; |
12
|
|
|
|
|
|
|
|
13
|
3
|
|
|
3
|
|
17
|
use base 'POSIX::1003::Module'; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
589
|
|
14
|
|
|
|
|
|
|
|
15
|
3
|
|
|
3
|
|
20
|
use warnings; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
101
|
|
16
|
3
|
|
|
3
|
|
15
|
use strict; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
70
|
|
17
|
|
|
|
|
|
|
|
18
|
3
|
|
|
3
|
|
14
|
use Carp 'croak'; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
485
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
my @constants; |
21
|
|
|
|
|
|
|
my @functions = qw/pathconf fpathconf pathconf_names/; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
our %EXPORT_TAGS = |
24
|
|
|
|
|
|
|
( constants => \@constants |
25
|
|
|
|
|
|
|
, functions => \@functions |
26
|
|
|
|
|
|
|
, tables => [ '%pathconf' ] |
27
|
|
|
|
|
|
|
); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
my $pathconf; |
30
|
|
|
|
|
|
|
our %pathconf; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
BEGIN { |
33
|
3
|
|
|
3
|
|
117
|
$pathconf = pathconf_table; |
34
|
3
|
|
|
|
|
57
|
push @constants, keys %$pathconf; |
35
|
3
|
|
|
|
|
32
|
tie %pathconf, 'POSIX::1003::ReadOnlyTable', $pathconf; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub pathconf($$); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub exampleValue($) |
42
|
0
|
|
|
0
|
1
|
0
|
{ my ($class, $name) = @_; |
43
|
0
|
0
|
|
|
|
0
|
$name =~ m/^_PC_/ or return; |
44
|
0
|
|
|
|
|
0
|
my $val = pathconf __FILE__, $name; |
45
|
0
|
0
|
|
|
|
0
|
defined $val ? $val : 'undef'; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub fpathconf($$) |
50
|
1
|
|
|
1
|
1
|
11
|
{ my ($fd, $key) = @_; |
51
|
1
|
50
|
|
|
|
8
|
$key =~ /^_PC_/ |
52
|
|
|
|
|
|
|
or croak "pass the constant name as string"; |
53
|
1
|
|
50
|
|
|
9
|
my $id = $pathconf{$key} // return; |
54
|
1
|
|
|
|
|
19
|
my $v = POSIX::fpathconf($fd, $id); |
55
|
1
|
50
|
33
|
|
|
16
|
defined $v && $v eq '0 but true' ? 0 : $v; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub pathconf($$) |
59
|
22
|
|
|
22
|
1
|
624
|
{ my ($fn, $key) = @_; |
60
|
22
|
50
|
|
|
|
77
|
$key =~ /^_PC_/ |
61
|
|
|
|
|
|
|
or croak "pass the constant name as string"; |
62
|
22
|
|
50
|
|
|
75
|
my $id = $pathconf{$key} // return; |
63
|
22
|
|
|
|
|
159
|
my $v = POSIX::pathconf($fn, $id); |
64
|
22
|
100
|
|
|
|
73
|
defined $v ? $v+0 : undef; # remove 'but true' from '0' |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub _create_constant($) |
68
|
1
|
|
|
1
|
|
3
|
{ my ($class, $name) = @_; |
69
|
1
|
|
50
|
0
|
|
11
|
my $id = $pathconf->{$name} // return sub($) {undef}; |
|
0
|
|
|
|
|
0
|
|
70
|
2
|
|
|
2
|
|
830
|
sub($) { my $f = shift; |
71
|
2
|
100
|
|
|
|
67
|
$f =~ m/\D/ |
72
|
|
|
|
|
|
|
? POSIX::pathconf($f, $id) |
73
|
|
|
|
|
|
|
: POSIX::fpathconf($f, $id) |
74
|
1
|
|
|
|
|
7
|
}; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
|
78
|
1
|
|
|
1
|
1
|
799
|
sub pathconf_names() { keys %$pathconf } |
79
|
|
|
|
|
|
|
|