lib/PersonName/Format/NullObject.pm

filter: Statementstmt 64.8% 35 / 54 Branchbran 30.0% 3 / 10 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 64.7% 11 / 17 Podpod 100% 1 / 1 totaltotal 58.6% 51 / 87 CC 8 SCAR 16.0
CC
8
Cov
58%
__ANON__
20.0
BEGIN
4.5
new
2.3
CRAP 5.0
« lib/PersonName/Format/Compiled.pm ↑ Summary lib/PersonName/Format/Name.pm »
1 ##----------------------------------------------------------------------------
2 ## Person Name Format - ~/lib/PersonName/Format/NullObject.pm
3 ## Version v0.1.0
4 ## Copyright(c) 2026 DEGUEST Pte. Ltd.
5 ## Author: Jacques Deguest <jack@deguest.jp>
6 ## Created 2026/07/17
7 ## Modified 2026/07/17
8 ## All rights reserved
9 ##
10 ## This program is free software; you can redistribute it and/or modify it
11 ## under the same terms as Perl itself.
12 ##----------------------------------------------------------------------------
13 package PersonName::Format::NullObject;
14 BEGIN
15 25 ▶{
Subroutine BEGIN: called CC=3 SCAR=15.1
16 25 ▶ use v5.10.1;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 25 ▶ use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 25 ▶ use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 25 ▶ if( $] < 5.013 )
Branch: 1 branch
BranchTrueFalseTotal
if ($] < "5.013") 0 25 25
20 {
21 25 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
22 0 ▶ unless( defined( &warnings::register_categories ) )
Branch: 1 branch
BranchTrueFalseTotal
unless (defined &warnings::register_categories) 0 0 0
23 {
24 *warnings::_mkMask = sub
25 0 ▶ {
Subroutine __ANON__: not called CC=1 SCAR=6.9
26 0 my $bit = shift( @_ );
27 0 my $mask = "";
28 0 vec( $mask, $bit, 1 ) = 1;
29 0 return( $mask );
30 0 };
31  
32 *warnings::register_categories = sub
33 0 ▶ {
Subroutine __ANON__: not called CC=4 SCAR=30.0
34 0 my @names = @_;
35 0 foreach my $name ( @names )
36 {
37 0 ▶ if( !defined( $warnings::Bits{ $name } ) )
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $warnings::Bits{$name}) 0 0 0
38 {
39 0 $warnings::Offsets{ $name } = $warnings::LAST_BIT;
40 0 $warnings::Bits{ $name } = warnings::_mkMask( $warnings::LAST_BIT++ );
41 0 $warnings::DeadBits{ $name } = warnings::_mkMask( $warnings::LAST_BIT++ );
42 0 ▶ if( length( $warnings::Bits{ $name } ) > length( $warnings::Bits{all} ) )
Branch: 1 branch
BranchTrueFalseTotal
if (length $warnings::Bits{$name} > length $warnings::Bits{"all"}) 0 0 0
43 {
44 0 $warnings::Bits{all} .= "\x55";
45 0 $warnings::DeadBits{all} .= "\xaa";
46 }
47 }
48 }
49 0 };
50 }
51 }
52 25 warnings::register_categories( 'PersonName::Format' );
53 25 ▶ use overload (
Subroutine BEGIN: called CC=1 SCAR=1.2
54 0 ▶ '""' => sub{ '' },
Subroutine __ANON__: not called CC=1 SCAR=6.9
55 0 ▶ '0+' => sub{0},
Subroutine __ANON__: not called CC=1 SCAR=6.9
56 0 ▶ bool => sub{0},
Subroutine __ANON__: not called CC=1 SCAR=6.9
57 25 fallback => 1,
58 25 );
59 25 ▶ use Wanted;
Subroutine BEGIN: called CC=1 SCAR=0.0
60 25 our( $VERSION ) = 'v0.1.0';
61 };
62  
63 25 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
64 25 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
65  
66 25 our $AUTOLOAD;
67  
68 sub new
69 1 ▶{
Subroutine new: called CC=2 SCAR=8.1
Pod documented
70 1 my $this = shift( @_ );
71 1 ▶ return( bless( {} => ( ref( $this ) || $this ) ) );
Condition33%1/3
ref $this || $this
l!l&&r!l&&!r
010
MC/DC0%0/2
ref $this || $this
ref $this $this
Truth table33%1/3
A || B
A= ref $thisB= $this
ABresult
1X1
011
000
72 }
73  
74 sub AUTOLOAD
75 2 ▶{
Subroutine AUTOLOAD: called CC=2 SCAR=6.9
76 2 my( $method ) = our $AUTOLOAD =~ /([^:]+)$/;
77 2 my $self = shift( @_ );
78 2 ▶ if( want( 'OBJECT' ) )
Branch: 1 branch
BranchTrueFalseTotal
if (want("OBJECT")) 1 1 2
79 {
80 1 rreturn( $self );
81 }
82 # Otherwise, we return undef; Empty return returns undef in scalar context and empty list in list context
83 1 return;
84 };
85  
86 0 ▶sub DESTROY { }
Subroutine DESTROY: not called CC=1 SCAR=0.0
87  
88 25 1;
89 # NOTE: POD
90 __END__
« lib/PersonName/Format/Compiled.pm ↑ Summary lib/PersonName/Format/Name.pm »