SpreadRevolutionaryDate/MsgMaker/RevolutionaryDate/Calendar.pm

filter: Statementstmt 100% 37 / 37 Branchbran 50.0% 4 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 100% 1 / 1 totaltotal 92.5% 50 / 54 CC 5 SCAR 10.1
CC
5
Cov
91%
set
5.2
BEGIN
1.0
BEGIN
1.0
CRAP 2.7
« SpreadRevolutionaryDate/MsgMaker/Telechat.pm ↑ Summary SpreadRevolutionaryDate/Target/Twitter.pm »
1 #
2 # This file is part of App-SpreadRevolutionaryDate
3 #
4 # This software is Copyright (c) 2019-2026 by Gérald Sédrati.
5 #
6 # This is free software, licensed under:
7 #
8 # The GNU General Public License, Version 3, June 2007
9 #
10 11 ▶use 5.014;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 11 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 package App::SpreadRevolutionaryDate::MsgMaker::RevolutionaryDate::Calendar;
13 11 $App::SpreadRevolutionaryDate::MsgMaker::RevolutionaryDate::Calendar::VERSION = '0.54';
14 # ABSTRACT: Subclass overloading L<DateTime::Calendar::FrenchRevolutionary> to allow language extension
15  
16 11 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 11 ▶use MooseX::NonMoose;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 11 extends 'DateTime::Calendar::FrenchRevolutionary';
19  
20 11 ▶use Class::Load ':all';
Subroutine BEGIN: called CC=1 SCAR=0.0
21 11 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23  
24 11 ▶sub set {
Subroutine set: called CC=5 SCAR=16.4
Pod documented
25 11 my $self = shift;
26 11 my %args = @_;
27  
28 11 my $locale_arg = delete $args{locale};
29 11 my $locale_class;
30  
31 11 ▶ if ($locale_arg) {
Branch: 1 branch
BranchTrueFalseTotal
if ($locale_arg) 11 0 11
32 11 ▶ die "only 'fr', 'en', 'it' and 'es' possible"
Branch: 1 branch
BranchTrueFalseTotal
unless $locale_arg =~ /^(?:en|fr|it|es)$/u 0 11 11
33 unless $locale_arg =~ /^(?:en|fr|it|es)$/;
34  
35 11 $locale_class = 'App::SpreadRevolutionaryDate::MsgMaker::RevolutionaryDate::Locale::' . $locale_arg;
36 }
37  
38 11 $self = $self->SUPER::set(%args);
39  
40 11 ▶ if ($locale_class) {
Branch: 1 branch
BranchTrueFalseTotal
if ($locale_class) 11 0 11
41 11 ▶ try_load_class($locale_class)
Branch: 1 branch
BranchTrueFalseTotal
try_load_class($locale_class) or die "Cannot import locale class $locale_class\n" 11 0 11
42 or die "Cannot import locale class $locale_class\n";
43 11 load_class($locale_class);
44 11 $self->{locale} = $locale_class->new();
45 }
46  
47 11 return $self;
48 }
49  
50  
51 11 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
52 11 __PACKAGE__->meta->make_immutable;
53  
54 # A module must return a true value. Traditionally, a module returns 1.
55 # But this module is a revolutionary one, so it discards all old traditions.
56 # Idea borrowed from Jean Forget's DateTime::Calendar::FrenchRevolutionary.
57 11 "Quand le gouvernement viole les droits du peuple,
58 l'insurrection est pour le peuple le plus sacré
59 et le plus indispensable des devoirs";
60  
61 __END__
« SpreadRevolutionaryDate/MsgMaker/Telechat.pm ↑ Summary SpreadRevolutionaryDate/Target/Twitter.pm »