| 1 | # This code is part of Perl distribution OODoc version 3.05. | ||||||||||||||||||||||||||||||||||||||||||
| 2 | # The POD got stripped from this file by OODoc version 3.05. | ||||||||||||||||||||||||||||||||||||||||||
| 3 | # For contributors see file ChangeLog. | ||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | # This software is copyright (c) 2003-2025 by Mark Overmeer. | ||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | # This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||||||||||||||||||||||||
| 8 | # the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||||||||||||||||||||||||
| 9 | # SPDX-License-Identifier: Artistic-1.0-Perl OR GPL-1.0-or-later | ||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | package OODoc;{ | ||||||||||||||||||||||||||||||||||||||||||
| 13 | 1 | our $VERSION = '3.05'; | |||||||||||||||||||||||||||||||||||||||||
| 14 | } | ||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | 1 | ▶ | use parent 'OODoc::Object'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | 1 | our $VERSION = '3.05'; # needed here for own release process | |||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||
| 23 | 1 | ▶ | use Log::Report 'oodoc'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||
| 25 | 1 | ▶ | use OODoc::Manifest (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 26 | 1 | ▶ | use OODoc::Format (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 27 | 1 | ▶ | use OODoc::Index (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||
| 29 | 1 | ▶ | use File::Basename qw/dirname/; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 30 | 1 | ▶ | use File::Copy qw/copy move/; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 31 | 1 | ▶ | use File::Spec::Functions qw/catfile/; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 32 | 1 | ▶ | use List::Util qw/first/; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 33 | 1 | ▶ | use Scalar::Util qw/blessed reftype/; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||
| 35 | #-------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||
| 37 | sub init($) | ||||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | ▶ | { my ($self, $args) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init: not called CC=11 SCAR=48.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | ▶ | $self->SUPER::init($args) or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||
| 42 | my $distribution = $self->{O_distribution} = delete $args->{distribution} | ||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | ▶ | or error __x"the produced distribution needs a project description"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | ▶ | $self->{O_project} = delete $args->{project} || $distribution; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
delete $args->{'project'} || $distribution
MC/DC0%0/2
delete $args->{'project'} || $distribution
delete $args->{'project'}
$distribution
Truth table0%0/3
A || B
A= delete $args->{'project'}B= $distribution
| |||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | my $version = delete $args->{version}; | |||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | ▶ | unless(defined $version) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | ▶ | { my $fn = -f 'version' ? 'version' : -f 'VERSION' ? 'VERSION' : undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | ▶ | if(defined $fn) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | ▶ | { open my $v, '<:encoding(UTF-8)', $fn | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 52 | or fault __x"cannot read distribution version from file {file}", file=> $fn; | ||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | $version = $v->getline; | |||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | ▶ | $version = $1 if $version =~ m/(\d+\.[\d\.]+)/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | chomp $version; | |||||||||||||||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | ▶ | $self->{O_version} = $version | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 60 | or error __x"no version specified for distribution {dist}", dist => $distribution; | ||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | $self->{O_index} = OODoc::Index->new; | |||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | $self; | |||||||||||||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | ▶ | sub publish { panic } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
publish: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||
| 68 | #-------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | ▶ | sub distribution() { $_[0]->{O_distribution} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
distribution: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | ▶ | sub version() { $_[0]->{O_version} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
version: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | ▶ | sub project() { $_[0]->{O_project} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
project: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | ▶ | sub index() { $_[0]->{O_index} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
index: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||
| 81 | #-------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||
| 83 | sub selectFiles($@) | ||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | ▶ | { my ($self, $filter, @files) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
selectFiles: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | my $ftype = reftype $filter; | |||||||||||||||||||||||||||||||||||||||||
| 87 | my $select | ||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | ▶ | = $ftype eq 'REGEXP' ? sub { $_[0] =~ $filter } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | ▶ | : $ftype eq 'CODE' ? $filter | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 90 | : $ftype eq 'ARRAY' ? $filter | ||||||||||||||||||||||||||||||||||||||||||
| 91 | : error __x"use regex, code reference or array for file selection, not {type}", type => $ftype; | ||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | ▶ | return ($select, []) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 94 | if reftype $select eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | my (@process, @copy); | |||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | foreach my $fn (@files) | |||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | ▶ | { if($select->($fn)) { push @process, $fn } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | else { push @copy, $fn } | |||||||||||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | ( \@process, \@copy ); | |||||||||||||||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||
| 106 | sub processFiles(@) | ||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | ▶ | { my ($self, %args) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
processFiles: not called CC=36 SCAR=71.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | my $dest = $args{workdir}; | |||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | my $source = $args{source}; | |||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | ▶ | my $distr = $args{distribution} || $self->distribution; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$args{'distribution'} || $self->distribution
MC/DC0%0/2
$args{'distribution'} || $self->distribution
$args{'distribution'}
$self->distribution
Truth table0%0/3
A || B
A= $args{'distribution'}B= $self->distribution
| |||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | my $version = $args{version}; | |||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | ▶ | unless(defined $version) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | ▶ | { my $fn = defined $source ? catfile($source, 'version') : 'version'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | ▶ | $fn = -f $fn ? $fn | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 117 | : defined $source ? catfile($source, 'VERSION') | ||||||||||||||||||||||||||||||||||||||||||
| 118 | : 'VERSION'; | ||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | ▶ | if(defined $fn) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | ▶ | { open my $v, '<:encoding(UTF-8)', $fn | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 121 | or fault __x"cannot read version from {file}", file => $fn; | ||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | $version = $v->getline; | |||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | ▶ | $version = $1 if $version =~ m/(\d+\.[\d\.]+)/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | chomp $version; | |||||||||||||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||||||||||||
| 126 | elsif($version = $self->version) { ; } | ||||||||||||||||||||||||||||||||||||||||||
| 127 | else | ||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | { error __x"there is no version defined for the source files"; | |||||||||||||||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | my $notice = ''; | |||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | ▶ | if($notice = $args{notice}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | { $notice =~ s/^([^#\n])/# $1/mg; # put comments if none | |||||||||||||||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||
| 137 | # | ||||||||||||||||||||||||||||||||||||||||||
| 138 | # Split the set of files into those who do need special processing | ||||||||||||||||||||||||||||||||||||||||||
| 139 | # and those who do not. | ||||||||||||||||||||||||||||||||||||||||||
| 140 | # | ||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||
| 142 | my $manfile | ||||||||||||||||||||||||||||||||||||||||||
| 143 | = exists $args{manifest} ? $args{manifest} | ||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | ▶ | : defined $source ? catfile($source, 'MANIFEST') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 145 | : 'MANIFEST'; | ||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | my $manifest = OODoc::Manifest->new(filename => $manfile); | |||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | my $manout; | |||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | ▶ | if(defined $dest) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | { my $manif = catfile $dest, 'MANIFEST'; | |||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | $manout = OODoc::Manifest->new(filename => $manif); | |||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | $manout->add($manif); | |||||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||||||
| 155 | else | ||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | { $manout = OODoc::Manifest->new(filename => undef); | |||||||||||||||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | ▶ | my $select = $args{select} || qr/\.(pm|pod)$/; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$args{'select'} || qr/\.(pm|pod)$/
MC/DC0%0/1
$args{'select'} || qr/\.(pm|pod)$/
$args{'select'}
Truth table0%0/2
A
A= $args{'select'}
| |||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | my ($process, $copy) = $self->selectFiles($select, @$manifest); | |||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | trace @$process." files to process and ".@$copy." files to copy"; | |||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||
| 164 | # | ||||||||||||||||||||||||||||||||||||||||||
| 165 | # Copy all the files which do not contain pseudo doc | ||||||||||||||||||||||||||||||||||||||||||
| 166 | # | ||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | ▶ | if(defined $dest) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | { foreach my $filename (@$copy) | |||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | ▶ | { my $fn = defined $source ? catfile($source, $filename) : $filename; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | my $dn = catfile $dest, $fn; | |||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | ▶ | unless(-f $fn) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | { warning __x"no file {file} to include in the distribution", file => $fn; | |||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | ▶ | unless(-e $dn && ( -M $dn < -M $fn ) && ( -s $dn == -s $fn )) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
-e $dn and -M $dn < -M $fn and -s $dn == -s $fn
-e $dn and -M $dn < -M $fn
MC/DC0%0/3
-e $dn and -M $dn < -M $fn and -s $dn == -s $fn
-e $dn
-M $dn < -M $fn
-s $dn == -s $fn
Truth table0%0/4
A and B and C
A= -e $dnB= -M $dn < -M $fnC= -s $dn == -s $fn
| |||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | { $self->mkdirhier(dirname $dn); | |||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | ▶ | copy $fn, $dn | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 182 | or fault __x"cannot copy distribution file {from} to {to}", from => $fn, to => $dest; | ||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | trace " copied $fn to $dest"; | |||||||||||||||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | $manout->add($dn); | |||||||||||||||||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||
| 191 | # | ||||||||||||||||||||||||||||||||||||||||||
| 192 | # Create the parser | ||||||||||||||||||||||||||||||||||||||||||
| 193 | # | ||||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | ▶ | my $parser = $args{parser} || 'OODoc::Parser::Markov'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$args{'parser'} || 'OODoc::Parser::Markov'
MC/DC0%0/1
$args{'parser'} || 'OODoc::Parser::Markov'
$args{'parser'}
Truth table0%0/2
A
A= $args{'parser'}
| |||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | ▶ | unless(blessed $parser) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | ▶ | { $parser = 'OODoc::Parser::Markov' if $parser eq 'markov'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | eval "require $parser"; | |||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | ▶ | $@ and error __x"cannot compile {pkg} class: {err}", pkg => $parser, err => $@; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | ▶ | $parser = $parser->new(skip_links => delete $args{skip_links}, index => $self->index) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 204 | or error __x"parser {name} could not be instantiated", name => $parser; | ||||||||||||||||||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||
| 207 | # | ||||||||||||||||||||||||||||||||||||||||||
| 208 | # Now process the rest | ||||||||||||||||||||||||||||||||||||||||||
| 209 | # | ||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | foreach my $filename (@$process) | |||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | ▶ | { my $fn = $source ? catfile($source, $filename) : $filename; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | ▶ | -f $fn | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 215 | or warning(__x"no file {file} to include in the distribution", file => $fn), next; | ||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | my $dn; | |||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | ▶ | if($dest) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | { $dn = catfile $dest, $fn; | |||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | $self->mkdirhier(dirname $dn); | |||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | $manout->add($dn); | |||||||||||||||||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||
| 224 | # do the stripping | ||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | my @manuals = $parser->parse( | |||||||||||||||||||||||||||||||||||||||||
| 226 | input => $fn, | ||||||||||||||||||||||||||||||||||||||||||
| 227 | output => $dn, | ||||||||||||||||||||||||||||||||||||||||||
| 228 | distribution => $distr, | ||||||||||||||||||||||||||||||||||||||||||
| 229 | version => $version, | ||||||||||||||||||||||||||||||||||||||||||
| 230 | notice => $notice, | ||||||||||||||||||||||||||||||||||||||||||
| 231 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | ▶ | trace "stripped $fn into $dn" if defined $dn; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | trace $_->stats for @manuals; | |||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | foreach my $man (@manuals) | |||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | ▶ | { $self->index->addManual($man) if $man->chapters; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | $self; | |||||||||||||||||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||
| 244 | #-------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||||||||
| 246 | sub finalize(%) | ||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | ▶ | { my ($self, %args) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
finalize: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | info "* collect package relations"; | |||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | $self->getPackageRelations; | |||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | my @manuals = $self->index->manuals; | |||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||
| 254 | 0 | info "* expand manual contents"; | |||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | $_->expand for @manuals; | |||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | info "* create inheritance chapters"; | |||||||||||||||||||||||||||||||||||||||||
| 258 | 0 | $_->createInheritance for @manuals; | |||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | info "* finalize each manual"; | |||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | $_->finalize(%args) for @manuals; | |||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | $self; | |||||||||||||||||||||||||||||||||||||||||
| 264 | } | ||||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | ▶ | sub prepare() { panic "OODoc 3.01 renamed prepare() into finalize." } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prepare: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||
| 269 | sub getPackageRelations($) | ||||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getPackageRelations: not called CC=16 SCAR=56.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 271 | 0 | my @manuals = $self->index->manuals; # all | |||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||
| 273 | 0 | info "compiling all packages"; | |||||||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | foreach my $manual (@manuals) | |||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | ▶ | { next if $manual->isPurePod; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 277 | 0 | trace " require package $manual"; | |||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||
| 279 | 0 | eval "require $manual"; | |||||||||||||||||||||||||||||||||||||||||
| 280 | 0 | ▶ | warning __x"errors from {manual}: {err}", manual => $manual, err =>$@ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$@ and not $@ =~ /can't locate/i and not $@ =~ /attempt to reload/i
$@ and not $@ =~ /can't locate/i
MC/DC0%0/3
$@ and not $@ =~ /can't locate/i and not $@ =~ /attempt to reload/i
$@
not $@ =~ /can't locate/i
not $@ =~ /attempt to reload/i
Truth table0%0/4
A and not(B) and not(C)
A= $@B= not $@ =~ /can't locate/iC= not $@ =~ /attempt to reload/i
| |||||||||||||||||||||||||||||||||||||||||||
| 281 | if $@ && $@ !~ /can't locate/i && $@ !~ /attempt to reload/i; | ||||||||||||||||||||||||||||||||||||||||||
| 282 | } | ||||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | info "detect inheritance relationships"; | |||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | my $index = $self->index; | |||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | foreach my $manual (@manuals) | |||||||||||||||||||||||||||||||||||||||||
| 288 | { | ||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | trace " relations for $manual"; | |||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||
| 291 | 0 | ▶ | if($manual->name ne $manual->package) # autoloaded code | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | { my $main = $index->mainManual("$manual"); | |||||||||||||||||||||||||||||||||||||||||
| 293 | 0 | ▶ | $main->extraCode($manual) if defined $main; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 294 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 295 | } | ||||||||||||||||||||||||||||||||||||||||||
| 296 | 0 | my %uses = $manual->collectPackageRelations; | |||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | ▶ | foreach (defined $uses{isa} ? @{$uses{isa}} : ()) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 299 | 0 | ▶ | { my $isa = $index->mainManual($_) || $_; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$index->mainManual($_) || $_
MC/DC0%0/2
$index->mainManual($_) || $_
$index->mainManual($_)
$_
Truth table0%0/3
A || B
A= $index->mainManual($_)B= $_
| |||||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||
| 301 | 0 | $manual->superClasses($isa); | |||||||||||||||||||||||||||||||||||||||||
| 302 | 0 | ▶ | $isa->subClasses($manual) if blessed $isa; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 303 | } | ||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||
| 305 | 0 | ▶ | if(my $realizes = $uses{realizes}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | ▶ | { my $to = $index->mainManual($realizes) || $realizes; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$index->mainManual($realizes) || $realizes
MC/DC0%0/2
$index->mainManual($realizes) || $realizes
$index->mainManual($realizes)
$realizes
Truth table0%0/3
A || B
A= $index->mainManual($realizes)B= $realizes
| |||||||||||||||||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||||||||||||||
| 308 | 0 | $manual->realizes($to); | |||||||||||||||||||||||||||||||||||||||||
| 309 | 0 | ▶ | $to->realizers($manual) if blessed $to; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 310 | } | ||||||||||||||||||||||||||||||||||||||||||
| 311 | } | ||||||||||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | $self; | |||||||||||||||||||||||||||||||||||||||||
| 314 | } | ||||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||||||||||||||||
| 317 | sub formatter($@) | ||||||||||||||||||||||||||||||||||||||||||
| 318 | 0 | ▶ | { my ($self, $format, %args) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
formatter: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||||||||||||||
| 320 | my $dest = delete $args{workdir} | ||||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | ▶ | or error __x"formatter() requires a directory to write the manuals to"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||||||||||||||
| 323 | # Start manifest | ||||||||||||||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||||||||||||||
| 325 | 0 | ▶ | my $manfile = delete $args{manifest} // catfile($dest, 'MANIFEST'); | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
delete $args{"manifest"} // catfile($dest, "MANIFEST")
MC/DC0%0/2
delete $args{"manifest"} // catfile($dest, "MANIFEST")
delete $args{"manifest"}
catfile($dest, "MANIFEST")
Truth table0%0/3
A // B
A= delete $args{"manifest"}B= catfile($dest, "MANIFEST")
| |||||||||||||||||||||||||||||||||||||||||||
| 326 | 0 | my $manifest = OODoc::Manifest->new(filename => $manfile); | |||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||
| 328 | # Create the formatter | ||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | ▶ | return $format | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
builtin::blessed($format) and $format->isa("OODoc::Format")
MC/DC0%0/2
builtin::blessed($format) and $format->isa("OODoc::Format")
builtin::blessed($format)
$format->isa("OODoc::Format")
Truth table0%0/3
A and B
A= builtin::blessed($format)B= $format->isa("OODoc::Format")
| |||||||||||||||||||||||||||||||||||||||||||
| 331 | if blessed $format && $format->isa('OODoc::Format'); | ||||||||||||||||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | OODoc::Format->new( | |||||||||||||||||||||||||||||||||||||||||
| 334 | %args, | ||||||||||||||||||||||||||||||||||||||||||
| 335 | format => $format, | ||||||||||||||||||||||||||||||||||||||||||
| 336 | manifest => $manifest, | ||||||||||||||||||||||||||||||||||||||||||
| 337 | workdir => $dest, | ||||||||||||||||||||||||||||||||||||||||||
| 338 | project => $self->distribution, | ||||||||||||||||||||||||||||||||||||||||||
| 339 | version => $self->version, | ||||||||||||||||||||||||||||||||||||||||||
| 340 | index => $self->index, | ||||||||||||||||||||||||||||||||||||||||||
| 341 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 342 | } | ||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||
| 344 | 0 | ▶ | sub create() { panic 'Interface change in 2.03: use $oodoc->formatter->createPages' } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
create: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||||||||||||
| 347 | sub stats() | ||||||||||||||||||||||||||||||||||||||||||
| 348 | 0 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
stats: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | my @manuals = $self->index->manuals; | |||||||||||||||||||||||||||||||||||||||||
| 350 | 0 | my $realpkg = $self->index->packageNames; | |||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | my $subs = map $_->subroutines, @manuals; | |||||||||||||||||||||||||||||||||||||||||
| 353 | 0 | my @options = map { map $_->options, $_->subroutines } @manuals; | |||||||||||||||||||||||||||||||||||||||||
| 354 | 0 | my $options = scalar @options; | |||||||||||||||||||||||||||||||||||||||||
| 355 | 0 | my $examples = map $_->examples, @manuals; | |||||||||||||||||||||||||||||||||||||||||
| 356 | 0 | my $diags = map $_->diagnostics, @manuals; | |||||||||||||||||||||||||||||||||||||||||
| 357 | 0 | my $version = $self->version; | |||||||||||||||||||||||||||||||||||||||||
| 358 | 0 | my $project = $self->project; | |||||||||||||||||||||||||||||||||||||||||
| 359 | 0 | my $nr_mans = @manuals; | |||||||||||||||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||||||||||||||||
| 361 | 0 | <<__STATS; | |||||||||||||||||||||||||||||||||||||||||
| 362 | Project $project contains: | ||||||||||||||||||||||||||||||||||||||||||
| 363 | Number of package manuals: $nr_mans | ||||||||||||||||||||||||||||||||||||||||||
| 364 | Real number of packages: $realpkg | ||||||||||||||||||||||||||||||||||||||||||
| 365 | documented subroutines: $subs | ||||||||||||||||||||||||||||||||||||||||||
| 366 | documented options: $options | ||||||||||||||||||||||||||||||||||||||||||
| 367 | documented diagnostics: $diags | ||||||||||||||||||||||||||||||||||||||||||
| 368 | shown examples: $examples | ||||||||||||||||||||||||||||||||||||||||||
| 369 | __STATS | ||||||||||||||||||||||||||||||||||||||||||
| 370 | } | ||||||||||||||||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||||||||||||||||
| 373 | sub mkdirhier($) | ||||||||||||||||||||||||||||||||||||||||||
| 374 | 0 | ▶ | { my $thing = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mkdirhier: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 375 | 0 | my @dirs = File::Spec->splitdir(shift); | |||||||||||||||||||||||||||||||||||||||||
| 376 | 0 | ▶ | my $path = $dirs[0] eq '' ? shift @dirs : '.'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||||||
| 378 | 0 | ▶ | while(@dirs) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 379 | 0 | { $path = File::Spec->catdir($path, shift @dirs); | |||||||||||||||||||||||||||||||||||||||||
| 380 | 0 | ▶ | -d $path || mkdir $path | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
-d $path or mkdir $path
MC/DC0%0/2
-d $path or mkdir $path
-d $path
mkdir $path
Truth table0%0/3
A or B
A= -d $pathB= mkdir $path
| |||||||||||||||||||||||||||||||||||||||||||
| 381 | or fault __x"cannot create {dir}", dir => $path; | ||||||||||||||||||||||||||||||||||||||||||
| 382 | } | ||||||||||||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||||||||||||
| 384 | 0 | $thing; | |||||||||||||||||||||||||||||||||||||||||
| 385 | } | ||||||||||||||||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||||||||||||||||
| 387 | #-------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||||||||||||||||
| 389 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||