| 1 | package QuadPres::FS; | ||||||||||||||||||||||||||||
| 2 | 1 | $QuadPres::FS::VERSION = '0.28.2'; | |||||||||||||||||||||||||||
| 3 | 1 | ▶ | use 5.016; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use parent 'QuadPres::Base'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 1 | __PACKAGE__->mk_acc_ref( [qw( gid group )] ); | |||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | sub _init | ||||||||||||||||||||||||||||
| 12 | { | ||||||||||||||||||||||||||||
| 13 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
_init: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 0 | my %args = @_; | |||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 0 | my $group; | |||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 0 | $group = $args{group}; | |||||||||||||||||||||||||||
| 20 | 0 | $self->set_group($group); | |||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | # Set the umask to ensure that other users which are a member of $group | ||||||||||||||||||||||||||||
| 23 | # can write to the files and directories generated by the program. | ||||||||||||||||||||||||||||
| 24 | 0 | umask(0002); | |||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 0 | return 0; | |||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | sub set_group | ||||||||||||||||||||||||||||
| 30 | { | ||||||||||||||||||||||||||||
| 31 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
set_group: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 0 | my $group = shift; | |||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 0 | $self->group($group); | |||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 0 | my $gid; | |||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | # Check if the group is not empty. | ||||||||||||||||||||||||||||
| 40 | 0 | ▶ | if ( defined($group) && ( $group !~ /^\s*$/ ) ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $group and not $group =~ /^\s*$/u
MC/DC0%0/2
defined $group and not $group =~ /^\s*$/u
defined $group
not $group =~ /^\s*$/u
Truth table0%0/3
A and not(B)
A= defined $groupB= not $group =~ /^\s*$/u
| |||||||||||||||||||||||||||||
| 41 | { | ||||||||||||||||||||||||||||
| 42 | 0 | ▶ | if ( $group =~ /^\d+$/ ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 43 | { | ||||||||||||||||||||||||||||
| 44 | 0 | $gid = $group; | |||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||
| 46 | else | ||||||||||||||||||||||||||||
| 47 | { | ||||||||||||||||||||||||||||
| 48 | 0 | my @group_info = getgrnam($group); | |||||||||||||||||||||||||||
| 49 | 0 | ▶ | if (@group_info) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 50 | { | ||||||||||||||||||||||||||||
| 51 | 0 | $gid = $group_info[2]; | |||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 0 | $self->gid($gid); | |||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | 0 | return 0; | |||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | sub my_chown | ||||||||||||||||||||||||||||
| 62 | { | ||||||||||||||||||||||||||||
| 63 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
my_chown: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | 0 | my $path = shift; | |||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | 0 | ▶ | if ( !defined( $self->gid ) ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 68 | { | ||||||||||||||||||||||||||||
| 69 | 0 | return; | |||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | 0 | chown( -1, $self->gid, $path ); | |||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | 0 | return; | |||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | sub make_dest_dir | ||||||||||||||||||||||||||||
| 78 | { | ||||||||||||||||||||||||||||
| 79 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
make_dest_dir: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | 0 | my $dest_dir = shift; | |||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | # Check if the destination directory exists and if not - | ||||||||||||||||||||||||||||
| 84 | # create it. | ||||||||||||||||||||||||||||
| 85 | 0 | ▶ | if ( !-e $dest_dir ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 86 | { | ||||||||||||||||||||||||||||
| 87 | 0 | mkdir($dest_dir); | |||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | # Make it belong to the common group | ||||||||||||||||||||||||||||
| 90 | 0 | $self->my_chown($dest_dir); | |||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | # Make it a SGID directory | ||||||||||||||||||||||||||||
| 93 | # This means that subsequent files will belong to its group. | ||||||||||||||||||||||||||||
| 94 | # And that subsequent directories inside will also be SGID. | ||||||||||||||||||||||||||||
| 95 | 0 | chmod( 02775, $dest_dir ); | |||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||
| 98 | 0 | return; | |||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||
| 101 | 1 | 1; | |||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | __END__ | ||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||
| 105 | =pod | ||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||
| 107 | =encoding UTF-8 | ||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||
| 109 | =head1 VERSION | ||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||
| 111 | version 0.28.2 | ||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||
| 113 | =for :stopwords cpan testmatrix url bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan | ||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||
| 115 | =head1 SUPPORT | ||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||
| 117 | =head2 Websites | ||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||
| 119 | The following websites have more information about this module, and may be of help to you. As always, | ||||||||||||||||||||||||||||
| 120 | in addition to those websites please use your favorite search engine to discover more resources. | ||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||
| 122 | =over 4 | ||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||
| 124 | =item * | ||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||
| 126 | MetaCPAN | ||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||
| 128 | A modern, open-source CPAN search engine, useful to view POD in HTML format. | ||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||
| 130 | L<https://metacpan.org/release/QuadPres> | ||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||
| 132 | =item * | ||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||
| 134 | RT: CPAN's Bug Tracker | ||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||
| 136 | The RT ( Request Tracker ) website is the default bug/issue tracking system for CPAN. | ||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||
| 138 | L<https://rt.cpan.org/Public/Dist/Display.html?Name=QuadPres> | ||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||
| 140 | =item * | ||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||
| 142 | CPANTS | ||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||
| 144 | The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution. | ||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||
| 146 | L<http://cpants.cpanauthors.org/dist/QuadPres> | ||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||
| 148 | =item * | ||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||
| 150 | CPAN Testers | ||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||
| 152 | The CPAN Testers is a network of smoke testers who run automated tests on uploaded CPAN distributions. | ||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||
| 154 | L<http://www.cpantesters.org/distro/Q/QuadPres> | ||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||
| 156 | =item * | ||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||
| 158 | CPAN Testers Matrix | ||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||
| 160 | The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms. | ||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||
| 162 | L<http://matrix.cpantesters.org/?dist=QuadPres> | ||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||
| 164 | =item * | ||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||
| 166 | CPAN Testers Dependencies | ||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||
| 168 | The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution. | ||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||
| 170 | L<http://deps.cpantesters.org/?module=QuadPres> | ||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||
| 172 | =back | ||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||
| 174 | =head2 Bugs / Feature Requests | ||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||
| 176 | Please report any bugs or feature requests by email to C<bug-quadpres at rt.cpan.org>, or through | ||||||||||||||||||||||||||||
| 177 | the web interface at L<https://rt.cpan.org/Public/Bug/Report.html?Queue=QuadPres>. You will be automatically notified of any | ||||||||||||||||||||||||||||
| 178 | progress on the request by the system. | ||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||
| 180 | =head2 Source Code | ||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||
| 182 | The code is open to the world, and available for you to hack on. Please feel free to browse it and play | ||||||||||||||||||||||||||||
| 183 | with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull | ||||||||||||||||||||||||||||
| 184 | from your repository :) | ||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||
| 186 | L<https://github.com/shlomif/quad-pres> | ||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||
| 188 | git clone https://github.com/shlomif/quad-pres.git | ||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||
| 190 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||
| 192 | Shlomi Fish <shlomif@cpan.org> | ||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||
| 194 | =head1 BUGS | ||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||
| 196 | Please report any bugs or feature requests on the bugtracker website | ||||||||||||||||||||||||||||
| 197 | L<https://github.com/shlomif/quad-pres/issues> | ||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||
| 199 | When submitting a bug or request, please include a test-file or a | ||||||||||||||||||||||||||||
| 200 | patch to an existing test-file that illustrates the bug or desired | ||||||||||||||||||||||||||||
| 201 | feature. | ||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||
| 203 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||
| 205 | This software is Copyright (c) 2019 by Shlomi Fish. | ||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||
| 207 | This is free software, licensed under: | ||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||
| 209 | The MIT (X11) License | ||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||
| 211 | =cut | ||||||||||||||||||||||||||||