| 1 | # Copyrights 2003-2021 by [Mark Overmeer]. | ||||||||||||||||||||||||||||
| 2 | # For other contributors see ChangeLog. | ||||||||||||||||||||||||||||
| 3 | # See the manual pages for details on the licensing terms. | ||||||||||||||||||||||||||||
| 4 | # Pod stripped from pm file by OODoc 2.02. | ||||||||||||||||||||||||||||
| 5 | # This code is part of perl distribution OODoc. It is licensed under the | ||||||||||||||||||||||||||||
| 6 | # same terms as Perl itself: https://spdx.org/licenses/Artistic-2.0.html | ||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | package OODoc::Object; | ||||||||||||||||||||||||||||
| 9 | 2 | ▶ | use vars '$VERSION'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 2 | $VERSION = '2.02'; | |||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 2 | ▶ | use Log::Report 'oodoc'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | sub new(@) | ||||||||||||||||||||||||||||
| 20 | 0 | ▶ | { my $class = shift; | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 0 | my %args = @_; | |||||||||||||||||||||||||||
| 23 | 0 | my $self = (bless {}, $class)->init(\%args); | |||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 0 | ▶ | if(my @missing = keys %args) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 26 | 0 | { error __xn"unknown option {options}", "unknown options {options}" | |||||||||||||||||||||||||||
| 27 | , scalar @missing, options => @missing; | ||||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | 0 | $self; | |||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | sub init($) | ||||||||||||||||||||||||||||
| 34 | 0 | ▶ | { my ($self, $args) = @_; | ||||||||||||||||||||||||||
|
Subroutine
init: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 35 | 0 | $self->{OO_extends} = []; | |||||||||||||||||||||||||||
| 36 | 0 | $self; | |||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | #------------------------------------------- | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | sub extends(;$) | ||||||||||||||||||||||||||||
| 43 | 0 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
extends: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 44 | 0 | my $ext = $self->{OO_extends}; | |||||||||||||||||||||||||||
| 45 | 0 | push @$ext, @_; | |||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | 0 | ▶ | wantarray ? @$ext : $ext->[0]; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | #------------------------------------------- | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | sub mkdirhier($) | ||||||||||||||||||||||||||||
| 54 | 0 | ▶ | { my $thing = shift; | ||||||||||||||||||||||||||
|
Subroutine
mkdirhier: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||
| 55 | 0 | my @dirs = File::Spec->splitdir(shift); | |||||||||||||||||||||||||||
| 56 | 0 | ▶ | my $path = $dirs[0] eq '' ? shift @dirs : '.'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | 0 | ▶ | while(@dirs) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 59 | 0 | { $path = File::Spec->catdir($path, shift @dirs); | |||||||||||||||||||||||||||
| 60 | 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
| |||||||||||||||||||||||||||||
| 61 | or fault __x"cannot create {dir}", dir => $path; | ||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | 0 | $thing; | |||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | sub filenameToPackage($) | ||||||||||||||||||||||||||||
| 69 | 0 | ▶ | { my ($thing, $package) = @_; | ||||||||||||||||||||||||||
|
Subroutine
filenameToPackage: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 70 | 0 | $package =~ s!^lib/!!; | |||||||||||||||||||||||||||
| 71 | 0 | $package =~ s#/#::#g; | |||||||||||||||||||||||||||
| 72 | 0 | $package =~ s/\.(pm|pod)$//g; | |||||||||||||||||||||||||||
| 73 | 0 | $package; | |||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | #------------------------------------------- | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | 2 | my %packages; | |||||||||||||||||||||||||||
| 80 | my %manuals; | ||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | sub addManual($) | ||||||||||||||||||||||||||||
| 83 | 0 | ▶ | { my ($self, $manual) = @_; | ||||||||||||||||||||||||||
|
Subroutine
addManual: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | 0 | ▶ | ref $manual && $manual->isa('OODoc::Manual') | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
ref $manual and $manual->isa("OODoc::Manual")
MC/DC0%0/2
ref $manual and $manual->isa("OODoc::Manual")
ref $manual
$manual->isa("OODoc::Manual")
Truth table0%0/3
A and B
A= ref $manualB= $manual->isa("OODoc::Manual")
| |||||||||||||||||||||||||||||
| 86 | or panic "manual definition requires manual object"; | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | 0 | push @{$packages{$manual->package}}, $manual; | |||||||||||||||||||||||||||
| 89 | 0 | $manuals{$manual->name} = $manual; | |||||||||||||||||||||||||||
| 90 | 0 | $self; | |||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | sub mainManual($) | ||||||||||||||||||||||||||||
| 95 | 0 | ▶ | { my ($self, $name) = @_; | ||||||||||||||||||||||||||
|
Subroutine
mainManual: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 96 | 0 | (grep {$_ eq $_->package} $self->manualsForPackage($name))[0]; | |||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | sub manualsForPackage($) | ||||||||||||||||||||||||||||
| 101 | 0 | ▶ | { my ($self,$name) = @_; | ||||||||||||||||||||||||||
|
Subroutine
manualsForPackage: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 102 | 0 | ▶ | $name ||= 'doc'; | ||||||||||||||||||||||||||
|
Condition0%0/2
$name ||= "doc"
MC/DC0%0/1
$name ||= "doc"
$name
Truth table0%0/2
A
A= $name
| |||||||||||||||||||||||||||||
| 103 | 0 | ▶ | defined $packages{$name} ? @{$packages{$name}} : (); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||
| 107 | 0 | ▶ | sub manuals() { values %manuals } | ||||||||||||||||||||||||||
|
Subroutine
manuals: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||
| 110 | 0 | ▶ | sub manual($) { $manuals{ $_[1] } } | ||||||||||||||||||||||||||
|
Subroutine
manual: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||
| 113 | 0 | ▶ | sub packageNames() { keys %packages } | ||||||||||||||||||||||||||
|
Subroutine
packageNames: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||
| 115 | 2 | 1; | |||||||||||||||||||||||||||