From 4eabe87a224863fca7c618c0affd5d14d04f6d90 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Fri, 30 May 2014 16:13:36 -0300 Subject: [PATCH] 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 Signed-off-by: Jonathan Druart Signed-off-by: Tomas Cohen Arazi --- C4/Serials.pm | 54 ++++++++++++++++++++++++--------------------------- 1 file changed, 25 insertions(+), 29 deletions(-) diff --git a/C4/Serials.pm b/C4/Serials.pm index 9657cbcaf5..bcb37e3707 100644 --- a/C4/Serials.pm +++ b/C4/Serials.pm @@ -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; } -- 2.39.5