Stripe/TimeZone.pm

filter: Statementstmt 57.1% 32 / 56 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 61.1% 11 / 18 Podpod 100% 2 / 2 totaltotal 51.7% 45 / 87 CC 5 SCAR 11.6
CC
5
Cov
49%
_obj_eq
9.5
init
6.0
__ANON__
2.0
CRAP 3.2
« Stripe/Event/Data.pm ↑ Summary Stripe/Identity.pm »
1 ##----------------------------------------------------------------------------
2 ## Stripe API - ~/lib/Net/API/Stripe/TimeZone.pm
3 ## Version v0.100.1
4 ## Copyright(c) 2020 DEGUEST Pte. Ltd.
5 ## Author: Jacques Deguest <jack@deguest.jp>
6 ## Created 2019/11/02
7 ## Modified 2024/09/05
8 ## All rights reserved.
9 ##
10 ##
11 ## This program is free software; you can redistribute it and/or modify it
12 ## under the same terms as Perl itself.
13 ##----------------------------------------------------------------------------
14 package Net::API::Stripe::TimeZone;
15 BEGIN
16 1 ▶{
Subroutine BEGIN: called CC=1 SCAR=0.0
17 1 ▶ use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶ use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 ▶ use vars qw( $VERSION );
Subroutine BEGIN: called CC=1 SCAR=0.0
20 1 ▶ use parent qw( Module::Generic );
Subroutine BEGIN: called CC=1 SCAR=0.0
21 1 ▶ use DateTime::TimeZone;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 1 ▶ use overload ('""' => 'name',
Subroutine BEGIN: called CC=1 SCAR=0.6
23 0 ▶ '==' => sub { _obj_eq(@_) },
Subroutine __ANON__: not called CC=1 SCAR=6.9
24 0 ▶ '!=' => sub { !_obj_eq(@_) },
Subroutine __ANON__: not called CC=1 SCAR=6.9
25 1 fallback => 1,
26 1 );
27 1 our( $VERSION ) = 'v0.100.1';
28 };
29  
30 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
31 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
32  
33 sub init
34 0 ▶{
Subroutine init: not called CC=2 SCAR=17.9
Pod documented
35 0 my $self = shift( @_ );
36 0 my $init = shift( @_ );
37 0 my $value = shift( @_ );
38 0 my $tz;
39 0 local $@;
40 # try-catch
41 eval
42 0 {
43 0 $tz = DateTime::TimeZone->new( name => $value, @_ );
44 };
45 0 ▶ if( $@ )
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
46 {
47 0 return( $self->error( "Invalid time zone '${tz}': $@" ) );
48 }
49 0 $self->{tz} = $tz;
50 0 return( $self->SUPER::init( @_ ) );
51 }
52  
53 0 ▶sub name { return( shift->{tz}->name ); }
Subroutine name: not called CC=1 SCAR=6.9
Pod documented
54  
55 sub _obj_eq
56 0 ▶{
Subroutine _obj_eq: not called CC=4 SCAR=22.5
57 # return overload::StrVal( $_[0] ) eq overload::StrVal( $_[1] );
58 1 ▶ no overloading;
Subroutine BEGIN: called CC=1 SCAR=0.0
59 0 my $self = shift( @_ );
60 0 my $other = shift( @_ );
61 0 ▶ return( 0 ) if( !ref( $other ) || !$other->isa( 'Net::API::Stripe::TimeZone' ) );
Branch: 1 branch
BranchTrueFalseTotal
unless ref $other and $other->isa("Net::API::Stripe::TimeZone") 0 0 0
Condition0%0/3
ref $other and $other->isa("Net::API::Stripe::TimeZone")
!ll&&!rl&&r
000
MC/DC0%0/2
ref $other and $other->isa("Net::API::Stripe::TimeZone")
ref $other $other->isa("Net::API::Stripe::TimeZone")
Truth table0%0/3
A and B
A= ref $otherB= $other->isa("Net::API::Stripe::TimeZone")
ABresult
0X0
100
111
62 0 my $name = $self->{tz}->name;
63 0 my $name2 = $other->{tz}->name;
64 0 ▶ return( 0 ) if( $name ne $name2 );
Branch: 1 branch
BranchTrueFalseTotal
if $name ne $name2 0 0 0
65 1 ▶ use overloading;
Subroutine BEGIN: called CC=1 SCAR=0.0
66 0 return( 1 );
67 }
68  
69 AUTOLOAD
70 0 ▶{
Subroutine AUTOLOAD: not called CC=1 SCAR=6.9
71 0 my( $method ) = our $AUTOLOAD =~ /([^:]+)$/;
72 0 my $self = shift( @_ );
73 0 return( $self->{tz}->$method( @_ ) );
74 };
75  
76 0 ▶DESTROY {};
Subroutine DESTROY: not called CC=1 SCAR=0.0
77  
78 1 1;
79 # NOTE: POD
80 __END__
« Stripe/Event/Data.pm ↑ Summary Stripe/Identity.pm »