FrenchRevolutionary/Locale/it.pm

filter: Statementstmt 95.3% 82 / 86 Branchbran 100% 4 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 90.4% 38 / 42 Podpod 91.6% 33 / 36 totaltotal 93.4% 157 / 168 CC 3 SCAR 1.7
CC
3
Cov
96%
am_pm
2.0
_datetime_format_pattern_order
2.0
month_names
2.0
CRAP 1.2
« FrenchRevolutionary/Locale/es.pm ↑ Summary
1 # -*- encoding: utf-8; indent-tabs-mode: nil -*-
2 #
3 # Perl DateTime extension for providing Italian strings for the French Revolutionary calendar
4 # Copyright (c) 2021 Jean Forget. All rights reserved.
5 #
6 # See the license in the embedded documentation below.
7 #
8  
9 package DateTime::Calendar::FrenchRevolutionary::Locale::it;
10  
11 3 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 3 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 3 $VERSION = '0.17'; # same as parent module DT::C::FR
17  
18 3 my @months_short = qw (Vnd Bru Fri Nev Pio Vnt Ger Fio Pra Mes Ter Fru G-S);
19  
20 # based on Gibus' App::SpreadRevolutionaryDate, itself
21 # based on Wikipedia: L<https://it.wikipedia.org/wiki/Calendario_rivoluzionario_francese>.
22 3 my @months = qw(Vendemmiaio Brumaio Frimaio
23 Nevoso Piovoso Ventoso
24 Germile Fiorile Pratile
25 Messidoro Termidoro Fruttidoro
26 );
27  
28 3 push @months, 'giorni supplementari';
29  
30 3 my @decade_days = qw (Primidi Duodi Tridi Quartidi Quintidi Sestidi Settidi Ottidi Nonidi Decadi);
31 3 my @decade_days_short = qw (Pri Duo Tri Qua Qui Sex Set Ott Non Dec);
32  
33 3 my @am_pms = qw(AM PM);
34  
35 3 my $date_before_time = "1";
36 3 my $default_date_format_length = "medium";
37 3 my $default_time_format_length = "medium";
38 3 my $date_parts_order = "dmy";
39  
40 3 my %date_formats = (
41 "short" => "\%d\/\%m\/\%Y",
42 "medium" => "\%a\ \%d\ \%b\ \%Y",
43 "long" => "\%A\ \%d\ \%B\ \%EY",
44 "full" => "\%A\ \%d\ \%B\ \%EY\,\ \%{feast_long\}",
45 );
46  
47 3 my %time_formats = (
48 "short" => "\%H\:\%M",
49 "medium" => "\%H\:\%M\:\%S",
50 "long" => "\%H\:\%M\:\%S",
51 "full" => "\%H\ h\ \%M\ mn \%S\ s",
52 );
53  
54 # When initializing an array with lists within lists, it means one of two things:
55 # Either it is a newbie who does not know how to make multi-dimensional arrays,
56 # Or it is a (at least mildly) experienced Perl-coder who, for some reason,
57 # wants to initialize a flat array with the concatenation of lists.
58 # I am a (at least mildly) experienced programmer who wants to use qw() and yet insert
59 # comments in some places.
60 # This array is mainly based on Gibus' App::SpreadRevolutionaryDate, itself
61 # based on Wikipedia: L<https://es.wikipedia.org/wiki/Calendario_republicano_franc%C3%A9s>.
62 3 my @feast = (
63 # Vendémiaire https://it.wikipedia.org/wiki/Vendemmiaio
64 qw(
65 2uva 1zafferano 3castagna 0colchico 0cavallo
66 3balsamina 3carota 2amaranto 3pastinaca 0tino
67 3patata 0perpetuino 3zucca 3reseda 2asino
68 3bella_di_notte 3zucca 0grano_saraceno 0girasole 0torchio
69 3canapa 0pesca 3rapa 2amarillide 0bue
70 3melanzana 0peperoncino 0pomodoro 2orzo 0barile
71 ),
72 # Brumaire https://it.wikipedia.org/wiki/Brumaio
73 qw(
74 0mela 0sedano 3pera 3barbabietola 2oca
75 2eliotropio 0fico 3scorzonera 0ciavardello 2aratro
76 3barba_di_becco 3castagna_d'acqua 0topinambur 2indivia 0tacchino
77 0sisaro 0crescione 3piombaggine 0melograno 2erpice
78 0baccaro 2azzeruolo 3robbia 2arancia 0fagiano
79 0pistacchio 3cicerchia 0cotogno 0sorbo 0rullo
80 ),
81 # Frimaire https://it.wikipedia.org/wiki/Frimaio
82 qw(
83 0raponzolo 3rapa 3cicoria 0nespolo 0maiale
84 0soncino 0cavolfiore 0miele 0ginepro 3zappa
85 3cera 0rafano 0cedro 2abete 0capriolo
86 0ginestrone 0cipresso 3edera 3sabina 3ascia
87 2acero_da_zucchero 2erica 3canna 2acetosa 0grillo
88 0pino 0sughero 0tartufo 2oliva 3pala
89 ),
90 # Nivôse https://it.wikipedia.org/wiki/Nevoso
91 qw(
92 3torba 0carbone_bituminoso 0bitume 0zolfo 0cane
93 3lava 3terra_vegetale 0letame 0salnitro 0correggiato
94 0granito 3argilla 2ardesia 2arenaria 0coniglio
95 3selce 3marna 0calcare 0marmo 0setaccio
96 0gesso 0sale 0ferro 0rame 0gatto
97 0stagno 0piombo 0zinco 0mercurio 0colino
98 ),
99 # Pluviôse https://it.wikipedia.org/wiki/Piovoso
100 qw(
101 3dafne_laurella 0muschio 0pungitopo 0bucaneve 0toro
102 0viburno 0fungo_dell'esca 3camalea 0pioppo 1scure
103 0elleboro 0broccolo 2alloro 0nocciolo 3vacca
104 0bosso 0lichene 0tasso 3polmonaria 0coltello_da_potatura
105 0thlaspi 3dafne_odorosa 3gramigna 0centinodio 3lepre
106 0guado 0nocciolo 0ciclamino 3celidonia 3slitta
107 ),
108 # Ventôse https://it.wikipedia.org/wiki/Ventoso
109 qw(
110 3tossillagine 0corniolo 3violacciocca 0ligustro 0caprone
111 0baccaro_comune 2alaterno 3violetta 0salicone 3vanga
112 0narciso 2olmo 3fumaria 2erisimo 3capra
113 0spinacio 0doronico 3primula 0cerfoglio 3corda
114 3mandragola 0prezzemolo 3coclearia 3margherita 0tonno
115 0dente_di_leone 2anemone 0capelvenere 0frassino 0piantatoio
116 ),
117 # Germinal https://it.wikipedia.org/wiki/Germinale
118 qw(
119 3primula 0platano 2asparago 0tulipano 3gallina
120 3bietola 3betulla 0narciso 0ontano 3covata
121 3pervinca 0carpino 3spugnola 0faggio 2ape
122 3lattuga 0larice 3cicuta 0ravanello 2arnia
123 2albero_di_Giuda 3lattuga 0ippocastano 3rucola 0piccione
124 0lillà 2anemone 3viola_del_pensiero 0mirtillo 0coltello_da_innesto
125 ),
126 # Floréal https://it.wikipedia.org/wiki/Fiorile
127 qw(
128 3rosa 3quercia 3felce 0biancospino 0usignolo
129 2aquilegia 0mughetto 0fungo 0giacinto 0rastrello
130 0rabarbaro 3lupinella 3violacciocca_gialla 3lonicera 0baco_da_seta
131 3consolida_maggiore 3pimpinella 2alisso_sassicolo 2atriplice 0sarchiello
132 3statice 3fritillaria 3borragine 3valeriana 3carpa
133 3fusaggine 3erba_cipollina 3buglossa 0senape 0vincastro
134 ),
135 # Prairial https://it.wikipedia.org/wiki/Pratile
136 qw(
137 3erba_medica 2emerocallide 0trifoglio 2angelica 2anatra
138 3melissa 2avena_altissima 0giglio_martagone 0timo_serpillo 3falce
139 3fragola 3betonica 0pisello 3acacia 3quaglia
140 0garofano 0sambuco 0papavero 0tiglio 0forcone
141 0fiordaliso 3camomilla 0caprifoglio 0caglio 3tinca
142 0gelsomino 3verbena 0timo 3peonia 0carro
143 ),
144 # Messidor https://it.wikipedia.org/wiki/Messidoro
145 qw(
146 3segale 2avena 3cipolla 3veronica 0mulo
147 0rosmarino 0cetriolo 1scalogno 2assenzio 0falcetto
148 0coriandolo 0carciofo 3violacciocca 3lavanda 0camoscio
149 0tabacco 0ribes 3cicerchia 3ciliegia 2ovile
150 3menta 0cumino 0fagiolo 2alcanna 3faraona
151 3salvia 2aglio 3veccia 0grano 3ciaramella
152 ),
153 # Thermidor https://it.wikipedia.org/wiki/Termidoro
154 qw(
155 1spelto 0tasso_barbasso 0melone 0loglio 2ariete
156 2equiseto 2artemisia 0cartamo 3mora 2annaffiatoio
157 2eringio 3salicornia 2albicocca 0basilico 3pecora
158 2altea 0lino 3mandorla 3genziana 3chiusa
159 3carlina_bianca 0cappero 3lenticchia 2enula 3lontra
160 0mirto 3colza 0lupino 0cotone 0mulino
161 ),
162 # Fructidor https://it.wikipedia.org/wiki/Fruttidoro
163 qw(
164 3prugna 0miglio 3vescia 2orzo_maschio 0salmone
165 3tuberosa 2orzo_comune 2apocino 3liquirizia 3scala
166 3anguria 0finocchio 3crespino 0noce 3trota
167 0limone 0cardo 2alaterno 0garofano_d'India 3gerla
168 3rosa_canina 3nocciola 0luppolo 0sorgo 0gambero
169 2arancio_amaro 3verga_d'oro 0granoturco 3castagna 3cesta
170 ),
171 # Jours complémentaires
172 qw(
173 3virtù 0genio 0lavoro 2opinione 4ricompense
174 3rivoluzione
175 ),
176 );
177 3 my @prefix = ( 'giorno del '
178 , 'giorno dello '
179 , "giorno dell'"
180 , 'giorno della '
181 , 'giorno delle '
182 );
183  
184 3 my %event = ();
185  
186 9 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
187 9 return bless {}, $_[0];
188 }
189  
190 6 ▶sub month_name {
Subroutine month_name: called CC=1 SCAR=0.0
Pod documented
191 6 my ($self, $date) = @_;
192 6 return $months[$date->month_0]
193 }
194  
195 3 ▶sub month_abbreviation {
Subroutine month_abbreviation: called CC=1 SCAR=0.0
Pod documented
196 3 my ($self, $date) = @_;
197 3 return $months_short[$date->month_0]
198 }
199  
200 8 ▶sub day_name {
Subroutine day_name: called CC=1 SCAR=0.0
Pod documented
201 8 my ($self, $date) = @_;
202 8 return $decade_days[$date->day_of_decade_0];
203 }
204  
205 5 ▶sub day_abbreviation {
Subroutine day_abbreviation: called CC=1 SCAR=0.0
Pod documented
206 5 my ($self, $date) = @_;
207 5 return $decade_days_short[$date->day_of_decade_0];
208 }
209  
210 4 ▶sub am_pm { $_[0]->am_pms->[ $_[1]->hour < 5 ? 0 : 1 ] }
Subroutine am_pm: called CC=2 SCAR=6.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
$_[1]->hour < 5 ? : 1 3 4
211  
212 1 ▶sub _raw_feast {
Subroutine _raw_feast: called CC=1 SCAR=0.0
213 1 my ($self, $date) = @_;
214 1 $feast[$date->day_of_year_0];
215 }
216  
217 1 ▶sub feast_short {
Subroutine feast_short: called CC=1 SCAR=0.0
Pod documented
218 1 my ($self, $date) = @_;
219 1 my $lb = $feast[$date->day_of_year_0];
220 1 $lb =~ s/^\?//;
221 1 $lb =~ s/_/ /g;
222 1 return substr($lb, 1);
223 }
224  
225 1 ▶sub feast_long {
Subroutine feast_long: called CC=1 SCAR=0.0
Pod documented
226 1 my ($self, $date) = @_;
227 1 my $lb = $feast[$date->day_of_year_0];
228 1 $lb =~ s/^\?//;
229 1 $lb =~ s/_/ /g;
230 1 $lb =~ s/^(\d)/$prefix[$1]/;
231 1 return $lb;
232 }
233  
234 4 ▶sub feast_caps {
Subroutine feast_caps: called CC=1 SCAR=0.0
Pod documented
235 4 my ($self, $date) = @_;
236 4 my $lb = $feast[$date->day_of_year_0];
237 4 $lb =~ s/^\?//;
238 4 $lb =~ s/_/ /g;
239 4 $lb =~ s/^(\d)(.)/\u$prefix[$1]\u$2/;
240 4 return $lb;
241 }
242  
243 4 ▶sub full_date_format { $_[0]->date_formats->{full} }
Subroutine full_date_format: called CC=1 SCAR=0.0
Pod documented
244 4 ▶sub long_date_format { $_[0]->date_formats->{long} }
Subroutine long_date_format: called CC=1 SCAR=0.0
Pod documented
245 4 ▶sub medium_date_format { $_[0]->date_formats->{medium} }
Subroutine medium_date_format: called CC=1 SCAR=0.0
Pod documented
246 4 ▶sub short_date_format { $_[0]->date_formats->{short} }
Subroutine short_date_format: called CC=1 SCAR=0.0
Pod documented
247 4 ▶sub default_date_format { $_[0]->date_formats->{ $_[0]->default_date_format_length } }
Subroutine default_date_format: called CC=1 SCAR=0.0
Pod documented
248  
249 4 ▶sub full_time_format { $_[0]->time_formats->{full} }
Subroutine full_time_format: called CC=1 SCAR=0.0
Pod documented
250 4 ▶sub long_time_format { $_[0]->time_formats->{long} }
Subroutine long_time_format: called CC=1 SCAR=0.0
Pod documented
251 4 ▶sub medium_time_format { $_[0]->time_formats->{medium} }
Subroutine medium_time_format: called CC=1 SCAR=0.0
Pod documented
252 4 ▶sub short_time_format { $_[0]->time_formats->{short} }
Subroutine short_time_format: called CC=1 SCAR=0.0
Pod documented
253 4 ▶sub default_time_format { $_[0]->time_formats->{ $_[0]->default_time_format_length } }
Subroutine default_time_format: called CC=1 SCAR=0.0
Pod documented
254  
255 10 ▶sub _datetime_format_pattern_order { $_[0]->date_before_time ? (0, 1) : (1, 0) }
Subroutine _datetime_format_pattern_order: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
$_[0]->date_before_time ? : 5 5 10
256  
257 2 ▶sub full_datetime_format { join ' ', ( $_[0]-> full_date_format, $_[0]-> full_time_format )[ $_[0]->_datetime_format_pattern_order ] }
Subroutine full_datetime_format: called CC=1 SCAR=0.0
Pod documented
258 2 ▶sub long_datetime_format { join ' ', ( $_[0]-> long_date_format, $_[0]-> long_time_format )[ $_[0]->_datetime_format_pattern_order ] }
Subroutine long_datetime_format: called CC=1 SCAR=0.0
Pod documented
259 2 ▶sub medium_datetime_format { join ' ', ( $_[0]-> medium_date_format, $_[0]-> medium_time_format )[ $_[0]->_datetime_format_pattern_order ] }
Subroutine medium_datetime_format: called CC=1 SCAR=0.0
Pod documented
260 2 ▶sub short_datetime_format { join ' ', ( $_[0]-> short_date_format, $_[0]-> short_time_format )[ $_[0]->_datetime_format_pattern_order ] }
Subroutine short_datetime_format: called CC=1 SCAR=0.0
Pod documented
261 2 ▶sub default_datetime_format { join ' ', ( $_[0]->default_date_format, $_[0]->default_time_format )[ $_[0]->_datetime_format_pattern_order ] }
Subroutine default_datetime_format: called CC=1 SCAR=0.0
Pod documented
262  
263 4 ▶sub default_date_format_length { $default_date_format_length }
Subroutine default_date_format_length: called CC=1 SCAR=0.0
Pod documented
264 4 ▶sub default_time_format_length { $default_time_format_length }
Subroutine default_time_format_length: called CC=1 SCAR=0.0
Pod documented
265  
266 0 ▶sub month_names { [ @months ] }
Subroutine month_names: not called CC=1 SCAR=6.9
Pod documented
267 0 ▶sub month_abbreviations { [ @months_short ] }
Subroutine month_abbreviations: not called CC=1 SCAR=6.9
Pod documented
268 0 ▶sub day_names { [ @decade_days ] }
Subroutine day_names: not called CC=1 SCAR=6.9
Pod documented
269 0 ▶sub day_abbreviations { [ @decade_days_short ] }
Subroutine day_abbreviations: not called CC=1 SCAR=6.9
Pod documented
270 4 ▶sub am_pms { [ @am_pms ] }
Subroutine am_pms: called CC=1 SCAR=0.0
Pod undocumented
271 20 ▶sub date_formats { \%date_formats }
Subroutine date_formats: called CC=1 SCAR=0.0
Pod documented
272 20 ▶sub time_formats { \%time_formats }
Subroutine time_formats: called CC=1 SCAR=0.0
Pod documented
273 5 ▶sub date_before_time { $date_before_time }
Subroutine date_before_time: called CC=1 SCAR=0.0
Pod undocumented
274 2 ▶sub date_parts_order { $date_parts_order }
Subroutine date_parts_order: called CC=1 SCAR=0.0
Pod undocumented
275  
276 1 ▶sub on_date {
Subroutine on_date: called CC=1 SCAR=0.0
Pod documented
277 1 return '';
278 }
279  
280 # A module must return a true value. Traditionally, a module returns 1.
281 # But this module is a revolutionary one, so it discards all old traditions.
282 3 "Ah ! ça ira ! ça ira !";
283  
284 __END__
« FrenchRevolutionary/Locale/es.pm ↑ Summary