| 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::Locale; | ||||||||||||||||||||||||||||
| 13 | 11 | $App::SpreadRevolutionaryDate::MsgMaker::RevolutionaryDate::Locale::VERSION = '0.54'; | |||||||||||||||||||||||||||
| 14 | # ABSTRACT: Role providing interface for localization of revolutionary date built by L<App::SpreadRevolutionaryDate::MsgMaker::RevolutionaryDate>. | ||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 11 | ▶ | use Moose::Role; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 11 | ▶ | use DateTime::Calendar::FrenchRevolutionary; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 11 | ▶ | use Locale::TextDomain 'App-SpreadRevolutionaryDate'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 21 | 11 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 11 | has months => ( | |||||||||||||||||||||||||||
| 24 | is => 'ro', | ||||||||||||||||||||||||||||
| 25 | isa => 'ArrayRef[Str]', | ||||||||||||||||||||||||||||
| 26 | required => 1, | ||||||||||||||||||||||||||||
| 27 | ); | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 11 | has decade_days => ( | |||||||||||||||||||||||||||
| 30 | is => 'ro', | ||||||||||||||||||||||||||||
| 31 | isa => 'ArrayRef[Str]', | ||||||||||||||||||||||||||||
| 32 | required => 1, | ||||||||||||||||||||||||||||
| 33 | ); | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 11 | has feast => ( | |||||||||||||||||||||||||||
| 36 | is => 'ro', | ||||||||||||||||||||||||||||
| 37 | isa => 'ArrayRef[Str]', | ||||||||||||||||||||||||||||
| 38 | required => 1, | ||||||||||||||||||||||||||||
| 39 | ); | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | has prefixes => ( | ||||||||||||||||||||||||||||
| 42 | is => 'ro', | ||||||||||||||||||||||||||||
| 43 | isa => 'ArrayRef[Str]', | ||||||||||||||||||||||||||||
| 44 | required => 1, | ||||||||||||||||||||||||||||
| 45 | 0 | ▶ | default => sub {['']}, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 46 | 11 | ); | |||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | 11 | has suffix => ( | |||||||||||||||||||||||||||
| 49 | is => 'ro', | ||||||||||||||||||||||||||||
| 50 | isa => 'Str', | ||||||||||||||||||||||||||||
| 51 | required => 1, | ||||||||||||||||||||||||||||
| 52 | default => '', | ||||||||||||||||||||||||||||
| 53 | ); | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 11 | has wikipedia_entries => ( | |||||||||||||||||||||||||||
| 56 | is => 'ro', | ||||||||||||||||||||||||||||
| 57 | isa => 'HashRef[HashRef[Str]]', | ||||||||||||||||||||||||||||
| 58 | required => 1, | ||||||||||||||||||||||||||||
| 59 | ); | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | 11 | ▶ | sub month_name { | ||||||||||||||||||||||||||
|
Subroutine
month_name: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 63 | 11 | my ($self, $date) = @_; | |||||||||||||||||||||||||||
| 64 | 11 | return $self->months->[$date->month_0] | |||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | 11 | ▶ | sub day_name { | ||||||||||||||||||||||||||
|
Subroutine
day_name: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 69 | 11 | my ($self, $date) = @_; | |||||||||||||||||||||||||||
| 70 | 11 | return $self->decade_days->[$date->day_of_decade_0]; | |||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | 11 | ▶ | sub feast_short { | ||||||||||||||||||||||||||
|
Subroutine
feast_short: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 75 | 11 | my ($self, $date) = @_; | |||||||||||||||||||||||||||
| 76 | 11 | my $lb = $self->feast->[$date->day_of_year_0]; | |||||||||||||||||||||||||||
| 77 | 11 | $lb =~ s/_/ /g; | |||||||||||||||||||||||||||
| 78 | 11 | return substr($lb, 1); | |||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | 11 | ▶ | sub feast_long { | ||||||||||||||||||||||||||
|
Subroutine
feast_long: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 83 | 11 | my ($self, $date) = @_; | |||||||||||||||||||||||||||
| 84 | 11 | my $lb = $self->feast->[$date->day_of_year_0] . $self->suffix; | |||||||||||||||||||||||||||
| 85 | 11 | $lb =~ s/_/ /g; | |||||||||||||||||||||||||||
| 86 | 11 | $lb =~ s/^(\d)/$self->prefixes->[$1]/e; | |||||||||||||||||||||||||||
| 87 | 11 | return $lb; | |||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | 11 | ▶ | sub wikipedia_redirect { | ||||||||||||||||||||||||||
|
Subroutine
wikipedia_redirect: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||
| 92 | 11 | my ($self, $month, $entry) = @_; | |||||||||||||||||||||||||||
| 93 | $entry = $self->wikipedia_entries->{$month}->{$entry} | ||||||||||||||||||||||||||||
| 94 | if exists $self->wikipedia_entries->{$month} | ||||||||||||||||||||||||||||
| 95 | 11 | ▶ | && exists $self->wikipedia_entries->{$month}->{$entry}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
exists $self->wikipedia_entries->{$month} and exists $self->wikipedia_entries->{$month}{$entry}
MC/DC50%1/2
exists $self->wikipedia_entries->{$month} and exists $self->wikipedia_entries->{$month}{$entry}
exists $self->wikipedia_entries->{$month}
exists $self->wikipedia_entries->{$month}{$entry}
Truth table66%2/3
A and B
A= exists $self->wikipedia_entries->{$month}B= exists $self->wikipedia_entries->{$month}{$entry}
| |||||||||||||||||||||||||||||
| 96 | 11 | return $entry; | |||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | # A module must return a true value. Traditionally, a module returns 1. | ||||||||||||||||||||||||||||
| 101 | # But this module is a revolutionary one, so it discards all old traditions. | ||||||||||||||||||||||||||||
| 102 | # Idea borrowed from Jean Forget's DateTime::Calendar::FrenchRevolutionary. | ||||||||||||||||||||||||||||
| 103 | 11 | "Quand le gouvernement viole les droits du peuple, | |||||||||||||||||||||||||||
| 104 | l'insurrection est pour le peuple le plus sacré | ||||||||||||||||||||||||||||
| 105 | et le plus indispensable des devoirs"; | ||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||
| 107 | __END__ | ||||||||||||||||||||||||||||