Bug 12338: Remove smartmatch operator from C4/Serials.pm
This patch removes the use of the 'when' smartmatch operator from Serials.pm Regards To+ Sponsored-by: Universidad Nacional de Cordoba Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This commit is contained in:
parent
7e694228c2
commit
4eabe87a22
|
|
@ -2668,36 +2668,32 @@ sub _numeration {
|
|||
$num_type //= '';
|
||||
$locale ||= 'en';
|
||||
my $string;
|
||||
given ($num_type) {
|
||||
when (/^dayname$/) {
|
||||
# 1970-11-01 was a Sunday
|
||||
$value = $value % 7;
|
||||
my $dt = DateTime->new(
|
||||
year => 1970,
|
||||
month => 11,
|
||||
day => $value + 1,
|
||||
locale => $locale,
|
||||
);
|
||||
$string = $dt->strftime("%A");
|
||||
}
|
||||
when (/^monthname$/) {
|
||||
$value = $value % 12;
|
||||
my $dt = DateTime->new(
|
||||
year => 1970,
|
||||
month => $value + 1,
|
||||
locale => $locale,
|
||||
);
|
||||
$string = $dt->strftime("%B");
|
||||
}
|
||||
when (/^season$/) {
|
||||
my @seasons= qw( Spring Summer Fall Winter );
|
||||
$value = $value % 4;
|
||||
$string = $seasons[$value];
|
||||
}
|
||||
default {
|
||||
$string = $value;
|
||||
}
|
||||
if ( $num_type =~ /^dayname$/ ) {
|
||||
# 1970-11-01 was a Sunday
|
||||
$value = $value % 7;
|
||||
my $dt = DateTime->new(
|
||||
year => 1970,
|
||||
month => 11,
|
||||
day => $value + 1,
|
||||
locale => $locale,
|
||||
);
|
||||
$string = $dt->strftime("%A");
|
||||
} elsif ( $num_type =~ /^monthname$/ ) {
|
||||
$value = $value % 12;
|
||||
my $dt = DateTime->new(
|
||||
year => 1970,
|
||||
month => $value + 1,
|
||||
locale => $locale,
|
||||
);
|
||||
$string = $dt->strftime("%B");
|
||||
} elsif ( $num_type =~ /^season$/ ) {
|
||||
my @seasons= qw( Spring Summer Fall Winter );
|
||||
$value = $value % 4;
|
||||
$string = $seasons[$value];
|
||||
} else {
|
||||
$string = $value;
|
||||
}
|
||||
|
||||
return $string;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue