SpreadRevolutionaryDate/MsgMaker.pm

filter: Statementstmt 100% 39 / 39 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod n/a totaltotal 97.9% 48 / 49 CC 2 SCAR 2.0
CC
2
Cov
98%
__ANON__
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« SpreadRevolutionaryDate/Target/Liberachat.pm ↑ Summary SpreadRevolutionaryDate/MsgMaker/RevolutionaryDate/Locale/en.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 16 ▶use 5.014;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 16 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 package App::SpreadRevolutionaryDate::MsgMaker;
13 16 $App::SpreadRevolutionaryDate::MsgMaker::VERSION = '0.54';
14 # ABSTRACT: Role providing interface for crafting a message to be spread by L<App::SpreadRevolutionaryDate>.
15  
16 16 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 16 ▶use Locale::Util qw(set_locale);
Subroutine BEGIN: called CC=1 SCAR=0.0
18 16 ▶use Locale::Messages qw(LC_ALL nl_putenv);
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 16 ▶use Locale::TextDomain 'App-SpreadRevolutionaryDate';
Subroutine BEGIN: called CC=1 SCAR=0.0
21 16 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 has locale => (
24 is => 'ro',
25 isa => 'Str',
26 required => 1,
27 default => 'en',
28 24 ▶ trigger => sub {
Subroutine __ANON__: called CC=2 SCAR=7.0
29 # Set locale to $val, see https://metacpan.org/pod/Locale::TextDomain::FAQ#How-do-I-switch-languages-or-force-a-certain-language-independently-from-user-settings-read-from-the-environment?
30 24 my ( $self, $val, $old_val ) = @_;
31 24 ▶ if ($val) {
Branch: 1 branch
BranchTrueFalseTotal
if ($val) 24 0 24
32 24 Locale::Messages->select_package('gettext_pp');
33 24 set_locale(LC_ALL, $val, undef, 'utf-8');
34 24 nl_putenv("LANGUAGE=$val");
35 24 nl_putenv("LANG=$val");
36 24 nl_putenv("OUTPUT_CHARSET=utf-8");
37 }
38 },
39 16 );
40  
41 16 has special_birthday_name => (
42 is => 'ro',
43 isa => 'Str',
44 default => '',
45 );
46  
47 16 has special_birthday_day => (
48 is => 'ro',
49 isa => 'Int',
50 default => 0,
51 );
52  
53 16 has special_birthday_month => (
54 is => 'ro',
55 isa => 'Int',
56 default => 0,
57 );
58  
59 16 has special_birthday_url => (
60 is => 'ro',
61 isa => 'Str',
62 default => '',
63 );
64  
65 16 has special_birthday_gemini => (
66 is => 'ro',
67 isa => 'Str',
68 default => '',
69 );
70  
71 16 has special_birthday_prefix => (
72 is => 'ro',
73 isa => 'Int',
74 default => 0,
75 );
76  
77 16 has special_birthday_plural => (
78 is => 'ro',
79 isa => 'Str',
80 default => '',
81 );
82  
83 16 has special_birthday_gender => (
84 is => 'ro',
85 isa => 'Str',
86 default => 'f',
87 );
88  
89 16 requires 'compute';
90  
91  
92 # A module must return a true value. Traditionally, a module returns 1.
93 # But this module is a revolutionary one, so it discards all old traditions.
94 # Idea borrowed from Jean Forget's DateTime::Calendar::FrenchRevolutionary.
95 16 "Quand le gouvernement viole les droits du peuple,
96 l'insurrection est pour le peuple le plus sacré
97 et le plus indispensable des devoirs";
98  
99 __END__
« SpreadRevolutionaryDate/Target/Liberachat.pm ↑ Summary SpreadRevolutionaryDate/MsgMaker/RevolutionaryDate/Locale/en.pm »