lib/OODoc/Object.pm

filter: Statementstmt 51.2% 20 / 39 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 35.7% 5 / 14 Podpod 80.0% 4 / 5 totaltotal 46.7% 29 / 62 CC 3 SCAR 9.7
CC
3
Cov
47%
new
6.0
publish
6.0
__ANON__
2.0
CRAP 2.6
« blib/lib/OODoc/Format/TemplateMagic.pm ↑ Summary blib/lib/OODoc/Format/Pod2.pm »
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::Object;{
13 2 our $VERSION = '3.05';
14 }
15  
16  
17 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 2 ▶use Log::Report 'oodoc';
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 2 ▶use List::Util qw/first/;
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 #--------------------
25  
26 use overload
27 0 ▶ '==' => sub {$_[0]->unique == $_[1]->unique},
Subroutine BEGIN: called CC=1 SCAR=1.2
Subroutine __ANON__: not called CC=1 SCAR=6.9
28 0 ▶ '!=' => sub {$_[0]->unique != $_[1]->unique},
Subroutine __ANON__: not called CC=1 SCAR=6.9
29 0 ▶ 'bool' => sub {1};
Subroutine __ANON__: not called CC=1 SCAR=0.2
30  
31 #--------------------
32  
33 sub new(@)
34 0 ▶{ my ($class, %args) = @_;
Subroutine new: not called CC=2 SCAR=17.9
Pod documented
35 0 my $self = (bless {}, $class)->init(\%args);
36  
37 0 ▶ if(my @missing = keys %args)
Branch: 1 branch
BranchTrueFalseTotal
if (my(@missing) = keys %args) 0 0 0
38 0 { error __xn"unknown object attribute '{names}' for {pkg}", "unknown object attributes for {pkg}: {names}",
39 scalar @missing, names => \@missing, pkg => $class;
40 }
41  
42 0 $self;
43 }
44  
45 2 my $unique = 42;
46  
47 sub init($)
48 0 ▶{ my ($self, $args) = @_;
Subroutine init: not called CC=1 SCAR=6.9
Pod undocumented
49  
50 # prefix with 'id', otherwise confusion between string and number
51 0 $self->{OO_unique} = 'id' . $unique++;
52 0 $self;
53 }
54  
55 #--------------------
56  
57 0 ▶sub unique() { $_[0]->{OO_unique} }
Subroutine unique: not called CC=1 SCAR=6.9
Pod documented
58  
59  
60 0 ▶sub manual() { panic }
Subroutine manual: not called CC=1 SCAR=6.9
Pod documented
61  
62 #--------------------
63  
64 2 my $index; # still a global :-( Set by ::Export
65 0 ▶sub _publicationIndex($) { $index = $_[1] }
Subroutine _publicationIndex: not called CC=1 SCAR=6.9
66  
67 sub publish($)
68 0 ▶{ my ($self, $args) = @_;
Subroutine publish: not called CC=2 SCAR=17.9
Pod documented
69 0 my $id = $self->unique;
70  
71 0 my $manual = $args->{manual};
72 0 ▶ $id .= '-' . $manual->unique if $manual->inherited($self);
Branch: 1 branch
BranchTrueFalseTotal
if $manual->inherited($self) 0 0 0
73  
74 0 $index->{$id} = +{ id => $id };
75 }
76  
77 2 1;
« blib/lib/OODoc/Format/TemplateMagic.pm ↑ Summary blib/lib/OODoc/Format/Pod2.pm »