| 1 | # Copyrights 2011-2013 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.01. | ||||||||||
| 5 | 4 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 4 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | package POSIX::1003::FS; | ||||||||||
| 9 | 4 | ▶ | use vars '$VERSION'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 1 | $VERSION = '0.98'; | |||||||||
| 11 | |||||||||||
| 12 | 4 | ▶ | use base 'POSIX::1003::Module'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | |||||||||||
| 14 | # Blocks resp from unistd.h, stdio.h, limits.h | ||||||||||
| 15 | 1 | my @constants; | |||||||||
| 16 | 1 | my @access = qw/access/; | |||||||||
| 17 | |||||||||||
| 18 | 1 | my @stat = qw/stat lstat | |||||||||
| 19 | S_ISDIR S_ISCHR S_ISBLK S_ISREG S_ISFIFO S_ISLNK S_ISSOCK S_ISWHT S_IFMT | ||||||||||
| 20 | S_IFBLK S_IFCHR S_IFDIR S_IFIFO S_IFLNK S_IFMT S_IFREG S_IFSOCK S_ISGID | ||||||||||
| 21 | S_ISUID S_ISVTX/; | ||||||||||
| 22 | |||||||||||
| 23 | 1 | my @perms = qw/S_IRGRP S_IROTH S_IRUSR S_IRWXG S_IRWXO S_IRWXU | |||||||||
| 24 | S_IWGRP S_IWOTH S_IWUSR S_IXGRP S_IXOTH S_IXUSR/; | ||||||||||
| 25 | |||||||||||
| 26 | 0 | ▶ | sub S_ISDIR($) { ($_[0] & S_IFMT()) == S_IFDIR()} | ||||||||
|
Subroutine
S_ISDIR: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 27 | 0 | ▶ | sub S_ISCHR($) { ($_[0] & S_IFMT()) == S_IFCHR()} | ||||||||
|
Subroutine
S_ISCHR: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 28 | 0 | ▶ | sub S_ISBLK($) { ($_[0] & S_IFMT()) == S_IFBLK()} | ||||||||
|
Subroutine
S_ISBLK: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 29 | 0 | ▶ | sub S_ISREG($) { ($_[0] & S_IFMT()) == S_IFREG()} | ||||||||
|
Subroutine
S_ISREG: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 30 | 0 | ▶ | sub S_ISFIFO($) { ($_[0] & S_IFMT()) == S_IFIFO()} | ||||||||
|
Subroutine
S_ISFIFO: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 31 | 0 | ▶ | sub S_ISLNK($) { ($_[0] & S_IFMT()) == S_IFLNK()} | ||||||||
|
Subroutine
S_ISLNK: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 32 | 0 | ▶ | sub S_ISSOCK($) { ($_[0] & S_IFMT()) == S_IFSOCK()} | ||||||||
|
Subroutine
S_ISSOCK: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 33 | 0 | ▶ | sub S_ISWHT($) { ($_[0] & S_IFMT()) == S_IFWHT()} # FreeBSD | ||||||||
|
Subroutine
S_ISWHT: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 34 | |||||||||||
| 35 | # POSIX.xs defines L_ctermid L_cuserid L_tmpname: useless! | ||||||||||
| 36 | |||||||||||
| 37 | # Blocks resp from sys/stat.h, unistd.h, utime.h, sys/types | ||||||||||
| 38 | 1 | my @functions = qw/ | |||||||||
| 39 | mkfifo mknod stat lstat rename | ||||||||||
| 40 | access lchown | ||||||||||
| 41 | utime | ||||||||||
| 42 | major minor makedev | ||||||||||
| 43 | /; | ||||||||||
| 44 | |||||||||||
| 45 | 1 | our @IN_CORE = qw(utime mkdir stat lstat rename); | |||||||||
| 46 | |||||||||||
| 47 | 1 | our %EXPORT_TAGS = | |||||||||
| 48 | ( constants => \@constants | ||||||||||
| 49 | , functions => \@functions | ||||||||||
| 50 | , access => \@access | ||||||||||
| 51 | , stat => \@stat | ||||||||||
| 52 | , tables => [ qw/%access %stat/ ] | ||||||||||
| 53 | , perms => \@perms | ||||||||||
| 54 | ); | ||||||||||
| 55 | |||||||||||
| 56 | 1 | my ($fsys, %access, %stat); | |||||||||
| 57 | |||||||||||
| 58 | BEGIN { | ||||||||||
| 59 | 1 | ▶ | $fsys = fsys_table; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 60 | 1 | push @constants, keys %$fsys; | |||||||||
| 61 | |||||||||||
| 62 | # initialize the :access export tag | ||||||||||
| 63 | 1 | push @access, grep /_OK$/, keys %$fsys; | |||||||||
| 64 | 1 | my %access_subset; | |||||||||
| 65 | 1 | @access_subset{@access} = @{$fsys}{@access}; | |||||||||
| 66 | 1 | tie %access, 'POSIX::1003::ReadOnlyTable', \%access_subset; | |||||||||
| 67 | |||||||||||
| 68 | # initialize the :fsys export tag | ||||||||||
| 69 | 1 | push @stat, grep /^S_/, keys %$fsys; | |||||||||
| 70 | 1 | my %stat_subset; | |||||||||
| 71 | 1 | @stat_subset{@stat} = @{$fsys}{@stat}; | |||||||||
| 72 | 1 | tie %stat, 'POSIX::1003::ReadOnlyTable', \%stat_subset; | |||||||||
| 73 | } | ||||||||||
| 74 | |||||||||||
| 75 | |||||||||||
| 76 | sub lchown($$@) | ||||||||||
| 77 | 0 | ▶ | { my ($uid, $gid) = (shift, shift); | ||||||||
|
Subroutine
lchown: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||
| 78 | 0 | my $successes = 0; | |||||||||
| 79 | 0 | ▶ | POSIX::lchown($uid, $gid, $_) && $successes++ for @_; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 80 | 0 | $successes; | |||||||||
| 81 | } | ||||||||||
| 82 | |||||||||||
| 83 | |||||||||||
| 84 | sub _create_constant($) | ||||||||||
| 85 | 0 | ▶ | { my ($class, $name) = @_; | ||||||||
|
Subroutine
_create_constant: not called CC=1 SCAR=6.9
| |||||||||||
| 86 | 0 | my $val = $fsys->{$name}; | |||||||||
| 87 | 0 | ▶ | sub() {$val}; | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 88 | } | ||||||||||
| 89 | |||||||||||
| 90 | 1 | 1; | |||||||||