| 1 | package CPAN::ParseDistribution; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 3829 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 132 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 88 | ▶ | use vars qw($VERSION); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 88 | $VERSION = '1.54'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 88 | ▶ | use Cwd qw(getcwd abs_path); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 88 | ▶ | use File::Temp qw(tempdir); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 88 | ▶ | use File::Find::Rule; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 88 | ▶ | use File::Path; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 88 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 88 | ▶ | use Archive::Tar; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 88 | ▶ | use Archive::Zip; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 88 | ▶ | use YAML qw(LoadFile); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 88 | ▶ | use Safe; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 88 | ▶ | use Parallel::ForkManager; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 88 | ▶ | use Devel::CheckOS qw(os_is); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 88 | $Archive::Tar::DO_NOT_USE_PREFIX = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 88 | $Archive::Tar::CHMOD = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | CPAN::ParseDistribution - index a file from the BackPAN | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | Given a file from the BackPAN, this will let you find out what versions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | of what modules it contains, the distribution name and version | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | my $dist = CPAN::ParseDistribution->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 'A/AU/AUTHORID/subdirectory/Some-Distribution-1.23.tar.gz', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | use_tar => '/bin/tar', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | ... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | my $modules = $dist->modules(); # hashref of modname => version | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | my $distname = $dist->dist(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | my $distversion = $dist->distversion(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | =head1 METHODS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | =head2 new | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | Constructor, takes a single mandatory argument, which should be a tarball | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | or zip file from the CPAN or BackPAN, and some optional named arguments: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | =over | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | =item use_tar | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | The full path to 'tar'. This is assumed to be GNU tar, and to be | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | sufficiently well-endowed as to be able to support bzip2 files. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | Maybe I'll fix that at some point. If this isn't specified, then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | Archive::Tar is used instead. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | You might want to use this if dealing with very large files, as | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | Archive::Tar is rather profligate with memory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 2500 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=6 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 2500 | my($class, $file, %extra_params) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 2500 | ▶ | die("file parameter is mandatory\n") unless($file); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 2500 | ▶ | die("$file doesn't exist\n") if(!-e $file); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 2455 | ▶ | die("$file looks like a ppm\n") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | if($file =~ /\.ppm\.(tar(\.gz|\.bz2)?|tbz|tgz|zip)$/i); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 2410 | ▶ | die("$file isn't the right type\n") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | if($file !~ /\.(tar(\.gz|\.bz2)?|tbz|tgz|zip)$/i); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 2365 | $file = abs_path($file); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | # dist name and version | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 2365 | (my $dist = $file) =~ s{(^.*/|\.(tar(\.gz|\.bz2)?|tbz|tgz|zip)$)}{}gi; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 2365 | $dist =~ /^(.*)-(\d.*)$/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 2365 | ($dist, my $distversion) = ($1, $2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 2365 | ▶ | die("Can't index perl itself ($dist-$distversion)\n") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | if($dist =~ /^(perl|ponie|kurila|parrot|Perl6-Pugs|v6-pugs)$/); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 2140 | bless { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | file => $file, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | modules => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | dist => $dist, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | distversion => $distversion, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | extra_params => \%extra_params, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | }, $class; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | # takes a filename, unarchives it, returns the directory it's been | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | # unarchived into | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 1930 | ▶ | sub _unarchive { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_unarchive: called CC=10 SCAR=23.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 1930 | my($file, %extra_params) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 1930 | my $olddir = getcwd(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 1930 | my $tempdir = tempdir(TMPDIR => 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 1930 | chdir($tempdir); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 1930 | ▶ | if($file =~ /\.zip$/i) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 115 | my $zip = Archive::Zip->new($file); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 115 | ▶ | $zip->extractTree() if($zip); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | } elsif($file =~ /\.(tar(\.gz)?|tgz)$/i) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 1581 | ▶ | if($extra_params{use_tar}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | system( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | $extra_params{use_tar}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 382 | ▶ | (($file =~ /gz$/) ? 'xzf' : 'xf'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | $file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 382 | system("chmod -R u+r *"); # tar might preserve unreadable perms | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 1199 | my $tar = Archive::Tar->new($file, 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 1199 | ▶ | $tar->extract() if($tar); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 234 | ▶ | if($extra_params{use_tar}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 74 | system( $extra_params{use_tar}, 'xjf', $file); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 74 | system("chmod -R u+r *"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 160 | ▶ | open(my $fh, '-|', qw(bzip2 -dc), $file) || die("Can't unbzip2\n"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 160 | my $tar = Archive::Tar->new($fh); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 160 | ▶ | $tar->extract() if($tar); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 1930 | chdir($olddir); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 1930 | return $tempdir; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | # adapted from PAUSE::pmfile::parse_version_safely in mldistwatch.pm | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 3963 | ▶ | sub _parse_version_safely { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_version_safely: called CC=13 SCAR=25.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 3963 | my($parsefile) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 3963 | my $result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | my $eval; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 3963 | local $/ = "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 3963 | ▶ | open(my $fh, $parsefile) or die "Could not open '$parsefile': $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 3963 | my $inpod = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 3963 | ▶ | while (<$fh>) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 86360 | ▶ | $inpod = /^=(?!cut)/ ? 1 : /^=cut/ ? 0 : $inpod; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 86360 | ▶ | next if $inpod || /^\s*#/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$inpod or /^\s*#/
MC/DC100%2/2
$inpod or /^\s*#/
$inpod
/^\s*#/
Truth table100%3/3
A or B
A= $inpodB= /^\s*#/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 53521 | chop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 53521 | ▶ | next unless /([\$*])(([\w\:\']*)\bVERSION)\b.*\=/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 3872 | my($sigil, $var) = ($1, $2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 3872 | my $current_parsed_line = $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 3872 | local $^W = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 88 | ▶ | no strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 3872 | my $c = Safe->new(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 3872 | ▶ | $c->deny(qw( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | tie untie tied chdir flock ioctl socket getpeername | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | ssockopt bind connect listen accept shutdown gsockopt | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | getsockname sleep alarm entereval reset dbstate | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | readline rcatline getc read formline enterwrite | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | leavewrite print sysread syswrite send recv eof | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | tell seek sysseek readdir telldir seekdir rewinddir | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | lock stat lstat readlink ftatime ftblk ftchr ftctime | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | ftdir fteexec fteowned fteread ftewrite ftfile ftis | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | ftlink ftmtime ftpipe ftrexec ftrowned ftrread ftsgid | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | ftsize ftsock ftsuid fttty ftzero ftrwrite ftsvtx | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | fttext ftbinary fileno ghbyname ghbyaddr ghostent | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | shostent ehostent gnbyname gnbyaddr gnetent snetent | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | enetent gpbyname gpbynumber gprotoent sprotoent | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | eprotoent gsbyname gsbyport gservent sservent | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | eservent gpwnam gpwuid gpwent spwent epwent | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | getlogin ggrnam ggrgid ggrent sgrent egrent msgctl | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | msgget msgrcv msgsnd semctl semget semop shmctl | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | shmget shmread shmwrite require dofile caller | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | syscall dump chroot link unlink rename symlink | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | truncate backtick system fork wait waitpid glob | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | exec exit kill time tms mkdir rmdir utime chmod | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | chown fcntl sysopen open close umask binmode | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | open_dir closedir | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | ), ($] >= 5.010 ? qw(say) : ())); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 3872 | $c->share_from(__PACKAGE__, [qw(qv)]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 3872 | s/\buse\s+version\b.*?;//gs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | # qv broke some time between version.pm 0.74 and 0.82 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | # so just extract it and hope for the best | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 3872 | s/\bqv\s*\(\s*(["']?)([\d\.]+)\1\s*\)\s*/"$2"/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 3872 | s/\buse\s+vars\b//g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 3872 | $eval = qq{ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | local ${sigil}${var}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | \$$var = undef; do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | $_ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | }; \$$var | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 3872 | $result = _run_safely($c, $eval); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | # stuff that's my fault because of the Safe compartment | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 3786 | ▶ | if($result->{error} && $result->{error} =~ /trapped by operation mask|safe compartment timed out/i) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
$result->{"error"} and $result->{"error"} =~ /trapped by operation mask|safe compartment timed out/i
MC/DC50%1/2
$result->{"error"} and $result->{"error"} =~ /trapped by operation mask|safe compartment timed out/i
$result->{"error"}
$result->{"error"} =~ /trapped by operation mask|safe compartment timed out/i
Truth table66%2/3
A and B
A= $result->{"error"}B= $result->{"error"} =~ /trapped by operation mask|safe compartment timed out/i
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 45 | warn("Unsafe code in \$VERSION\n".$result->{error}."\n$parsefile\n$eval"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 45 | $result = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | } elsif($result->{error}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | warn "_parse_version_safely: ".Dumper({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | eval => $eval, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | line => $current_parsed_line, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | file => $parsefile, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | err => $result->{error}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 3786 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 3877 | close $fh; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 3877 | ▶ | return exists($result->{result}) ? $result->{result} : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 3872 | ▶ | sub _run_safely { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_run_safely: called CC=3 SCAR=14.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 3872 | ▶ | if(os_is('Unix')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 87 | ▶ | eval 'use CPAN::ParseDistribution::Unix'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 3872 | return CPAN::ParseDistribution::Unix->_run(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | } elsif(os_is('MicrosoftWindows')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | # FIXME once someone supplies CPAN::ParseDistribution::Windows | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | warn("Windows is not fully supported by CPAN::ParseDistribution\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | warn("See the LIMITATIONS section in the documentation\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | eval 'use CPAN::ParseDistribution::Unix'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | return CPAN::ParseDistribution::Unix->_run(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | =head2 isdevversion | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | Returns true or false depending on whether this is a developer-only | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | or trial release of a distribution. This is determined by looking for | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | an underscore in the distribution version or the string '-TRIAL' at the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | end of the distribution version. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 317 | ▶ | sub isdevversion { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
isdevversion: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 317 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 317 | ▶ | return 1 if($self->distversion() =~ /(_|-TRIAL$)/); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 107 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | =head2 modules | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | Returns a hashref whose keys are module names, and their values are | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | the versions of the modules. The version number is retrieved by | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | eval()ing what looks like a $VERSION line in the code. This is done | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | in a C<Safe> compartment, but may be a security risk if you do this | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | with untrusted code. Caveat user! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 2035 | ▶ | sub modules { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
modules: called CC=26 SCAR=34.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 2035 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 2035 | ▶ | if(!(keys %{$self->{modules}})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 1930 | $self->{_modules_runs}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 1930 | my $tempdir = _unarchive($self->{file}, %{$self->{extra_params}}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 1930 | my $meta = (File::Find::Rule->file()->name('META.yml')->in($tempdir))[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 1930 | my $ignore = join('|', qw(t inc xt)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 1930 | my %ignorefiles; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | my %ignorepackages; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 1930 | my %ignorenamespaces; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 1930 | ▶ | if($meta && -e $meta) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$meta and -e $meta
MC/DC50%1/2
$meta and -e $meta
$meta
-e $meta
Truth table66%2/3
A and B
A= $metaB= -e $meta
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 1495 | my $yaml = eval { LoadFile($meta); }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 1495 | ▶ | if(!$@ && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
not $@ and ref $yaml eq "HASH" and exists $yaml->{"no_index"} and ref $yaml->{"no_index"} eq "HASH"
not $@ and ref $yaml eq "HASH" and exists $yaml->{"no_index"}
not $@ and ref $yaml eq "HASH"
MC/DC0%0/4
not $@ and ref $yaml eq "HASH" and exists $yaml->{"no_index"} and ref $yaml->{"no_index"} eq "HASH"
not $@
ref $yaml eq "HASH"
exists $yaml->{"no_index"}
ref $yaml->{"no_index"} eq "HASH"
Truth table20%1/5
not(A) and B and C and D
A= not $@B= ref $yaml eq "HASH"C= exists $yaml->{"no_index"}D= ref $yaml->{"no_index"} eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | # can we hash-deref this thing? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | ref($yaml) eq 'HASH' && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | exists($yaml->{no_index}) && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | ref($yaml->{no_index}) eq 'HASH' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 1495 | ▶ | if(exists($yaml->{no_index}->{directory})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 1309 | ▶ | if(ref($yaml->{no_index}->{directory}) eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | $ignore = join('|', $ignore, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 1206 | map { "$_/" } @{$yaml->{no_index}->{directory}} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | } elsif(!ref($yaml->{no_index}->{directory})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 103 | $ignore .= '|'.$yaml->{no_index}->{directory}.'/' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 1495 | ▶ | if(exists($yaml->{no_index}->{file})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 233 | ▶ | if(ref($yaml->{no_index}->{file}) eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 233 | %ignorefiles = map { $_, 1 } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 233 | @{$yaml->{no_index}->{file}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | } elsif(!ref($yaml->{no_index}->{file})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 0 | $ignorefiles{$yaml->{no_index}->{file}} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 1495 | ▶ | if(exists($yaml->{no_index}->{package})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 279 | ▶ | if(ref($yaml->{no_index}->{package}) eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 372 | %ignorepackages = map { $_, 1 } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 279 | @{$yaml->{no_index}->{package}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | } elsif(!ref($yaml->{no_index}->{package})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | $ignorepackages{$yaml->{no_index}->{package}} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 1495 | ▶ | if(exists($yaml->{no_index}->{namespace})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 91 | ▶ | if(ref($yaml->{no_index}->{namespace}) eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 91 | %ignorenamespaces = map { $_, 1 } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 91 | @{$yaml->{no_index}->{namespace}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | } elsif(!ref($yaml->{no_index}->{namespace})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 0 | $ignorenamespaces{$yaml->{no_index}->{namespace}} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | # find modules | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | my @PMs = grep { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 1930 | my $pm = $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | $pm !~ m{^\Q$tempdir\E/[^/]+/($ignore)} && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 6928 | ▶ | !grep { $pm =~ m{^\Q$tempdir\E/[^/]+/$_$} } (keys %ignorefiles) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$pm =~ m[^\Q$tempdir\E/[^/]+/($ignore)] || grep({$pm =~ m[^\Q$tempdir\E/[^/]+/$_$];} keys %ignorefiles)
MC/DC100%2/2
$pm =~ m[^\Q$tempdir\E/[^/]+/($ignore)] || grep({$pm =~ m[^\Q$tempdir\E/[^/]+/$_$];} keys %ignorefiles)
$pm =~ m[^\Q$tempdir\E/[^/]+/($ignore)]
grep({$pm =~ m[^\Q$tempdir\E/[^/]+/$_$];} keys %ignorefiles)
Truth table100%3/3
A || B
A= $pm =~ m[^\Q$tempdir\E/[^/]+/($ignore)]B= grep({$pm =~ m[^\Q$tempdir\E/[^/]+/$_$];} keys %ignorefiles)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | } File::Find::Rule->file()->name('*.pm', '*.pm.PL')->in($tempdir); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 1930 | foreach my $PM (@PMs) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 3963 | local $/ = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 3963 | my $version = _parse_version_safely($PM); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 3877 | ▶ | open(my $fh, $PM) || die("Can't read $PM\n"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 3877 | $PM = <$fh>; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 3877 | close($fh); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | # from PAUSE::pmfile::packages_per_pmfile in mldistwatch.pm | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 3877 | ▶ | if($PM =~ /\bpackage[ \t]+([\w\:\']+)\s*($|[};])/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 3824 | my $module = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | $self->{modules}->{$module} = $version unless( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | exists($ignorepackages{$module}) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 3824 | ▶ | (grep { $module =~ /${_}::/ } keys %ignorenamespaces) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
exists $ignorepackages{$module} or grep {$module =~ /$_::/;} keys %ignorenamespaces
MC/DC100%2/2
exists $ignorepackages{$module} or grep {$module =~ /$_::/;} keys %ignorenamespaces
exists $ignorepackages{$module}
grep {$module =~ /$_::/;} keys %ignorenamespaces
Truth table100%3/3
A or B
A= exists $ignorepackages{$module}B= grep {$module =~ /$_::/;} keys %ignorenamespaces
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 1844 | rmtree($tempdir); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 1949 | return $self->{modules}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | =head2 dist | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | Return the name of the distribution. eg, in the synopsis above, it would | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | return 'Some-Distribution'. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 107 | ▶ | sub dist { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dist: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 107 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 107 | return $self->{dist}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | =head2 distversion | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | Return the version of the distribution. eg, in the synopsis above, it would | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | return 1.23. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | Strictly speaking, the CPAN doesn't have distribution versions - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | Foo-Bar-1.23.tar.gz is not considered to have any relationship to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | Foo-Bar-1.24.tar.gz, they just happen to coincidentally have rather | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | similar contents. But other tools, such as those used by the CPAN testers, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | do treat distributions as being versioned. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 634 | ▶ | sub distversion{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
distversion: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 634 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 634 | return $self->{distversion}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | =head1 SECURITY | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | This module executes a very small amount of code from each module that | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | it finds in a distribution. While every effort has been made to do | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | this safely, there are no guarantees that it won't let the distributions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | you're examining do horrible things to your machine, such as email your | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | password file to strangers. You are strongly advised to read the source | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | code and to run it in a very heavily restricted user account. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | =head1 LIMITATIONS, BUGS and FEEDBACK | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | I welcome feedback about my code, including constructive criticism. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | Bug reports should be made using L<Github Issues|https://github.com/DrHyde/perl-modules-CPAN-ParseDistribution/issues> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | and should include the smallest possible chunk of code, along with | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | any necessary data, which demonstrates the bug. Ideally, this | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | will be in the form of files which I can drop in to the module's | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | test suite. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | There is a known problem with parsing some pathological distributions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | on Windows, where CPAN::ParseDistribution may either hang or crash. This | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | is because Windows doesn't properly support fork()ing and signals. I can | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | not fix this, but welcome patches with tests. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | =head1 SEE ALSO | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | L<http://pause.perl.org/> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | L<dumpcpandist> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | =head1 AUTHOR, COPYRIGHT and LICENCE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | Copyright 2009-2011 David Cantrell E<lt>david@cantrell.org.ukE<gt> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | Contains code originally from the PAUSE by Andreas Koenig. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | This software is free-as-in-speech software, and may be used, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | distributed, and modified under the terms of either the GNU | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | General Public Licence version 2 or the Artistic Licence. It's | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | up to you which one you use. The full text of the licences can | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | be found in the files GPL2.txt and ARTISTIC.txt, respectively. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | =head1 CONSPIRACY | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | This module is also free-as-in-mason software. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | 88 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||