Bugzilla – Attachment 28689 Details for
Bug 12338
Remove smartmatch operator from C4/Serials.pm
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12338: Remove smartmatch operator from C4/Serials.pm
Bug-12338-Remove-smartmatch-operator-from-C4Serial.patch (text/plain), 2.45 KB, created by
Chris Cormack
on 2014-06-05 20:28:44 UTC
(
hide
)
Description:
Bug 12338: Remove smartmatch operator from C4/Serials.pm
Filename:
MIME Type:
Creator:
Chris Cormack
Created:
2014-06-05 20:28:44 UTC
Size:
2.45 KB
patch
obsolete
>From dfde6a683ce266c6ce48e807c222979f57456ac0 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@gmail.com> >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 <chrisc@catalyst.net.nz> >--- > C4/Serials.pm | 54 +++++++++++++++++++++++++----------------------------- > 1 file changed, 25 insertions(+), 29 deletions(-) > >diff --git a/C4/Serials.pm b/C4/Serials.pm >index 9657cbc..bcb37e3 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.0.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 12338
:
28578
|
28689
|
28698