Bugzilla – Attachment 9750 Details for
Bug 6679
Fixing code so it passes basic Perl::Critic tests
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Fixing 13 perlcritic violations in C4/Barcodes.pm
Fixing-13-perlcritic-violations-in-C4Barcodespm.patch (text/plain), 3.78 KB, created by
Mason James
on 2012-05-23 21:02:35 UTC
(
hide
)
Description:
Fixing 13 perlcritic violations in C4/Barcodes.pm
Filename:
MIME Type:
Creator:
Mason James
Created:
2012-05-23 21:02:35 UTC
Size:
3.78 KB
patch
obsolete
>From e08771ebfb44691a58e1dc55f55d7d46c788a714 Mon Sep 17 00:00:00 2001 >From: Mason James <mtj@kohaaloha.com> >Date: Thu, 24 May 2012 09:01:57 +1200 >Subject: [PATCH] Fixing 13 perlcritic violations in C4/Barcodes.pm >Content-Type: text/plain; charset="utf-8" >http://koha-community.org > >Subroutine prototypes used at line XXX, column 1. See page 194 of PBP. (Severity: 5) > >http://bugs.koha-community.org/show_bug.cgi?id=6679 >--- > C4/Barcodes.pm | 26 +++++++++++++------------- > 1 files changed, 13 insertions(+), 13 deletions(-) > >diff --git a/C4/Barcodes.pm b/C4/Barcodes.pm >index a528bd9..7bc384f 100644 >--- a/C4/Barcodes.pm >+++ b/C4/Barcodes.pm >@@ -56,21 +56,21 @@ sub initial { > sub width { > return undef; > } >-sub process_head($$;$$) { # (self,head,whole,specific) >+sub process_head { # (self,head,whole,specific) > my $self = shift; > return shift; # Default: just return the head unchanged. > } >-sub process_tail($$;$$) { # (self,tail,whole,specific) >+sub process_tail { # (self,tail,whole,specific) > my $self = shift; > return shift; # Default: just return the tail unchanged. > } >-sub is_max ($;$) { >+sub is_max { > my $self = shift; > ref($self) or carp "Called is_max on a non-object: '$self'"; > (@_) and $self->{is_max} = shift; > return $self->{is_max} || 0; > } >-sub value ($;$) { >+sub value { > my $self = shift; > if (@_) { > my $value = shift; >@@ -83,14 +83,14 @@ sub value ($;$) { > } > return $self->{value}; > } >-sub autoBarcode (;$) { >+sub autoBarcode { > (@_) or return _prefformat; > my $self = shift; > my $value = $self->{autoBarcode} or return _prefformat; > $value =~ s/^.*:://; # in case we get C4::Barcodes::incremental, we just want 'incremental' > return $value; > } >-sub parse ($;$) { # return 3 parts of barcode: non-incrementing, incrementing, non-incrementing >+sub parse { # return 3 parts of barcode: non-incrementing, incrementing, non-incrementing > my $self = shift; > my $barcode = (@_) ? shift : $self->value; > unless ($barcode =~ /(.*?)(\d+)$/) { # non-greedy match in first part >@@ -100,7 +100,7 @@ sub parse ($;$) { # return 3 parts of barcode: non-incrementing, incrementing, n > $debug and warn "Barcode '$barcode' parses into: '$1', '$2', ''"; > return ($1,$2,''); # the third part is in anticipation of barcodes that include checkdigits > } >-sub max ($;$) { >+sub max { > my $self = shift; > if ($self->{is_max}) { > $debug and print STDERR "max taken from Barcodes value $self->value\n"; >@@ -109,14 +109,14 @@ sub max ($;$) { > $debug and print STDERR "Retrieving max database query.\n"; > return $self->db_max; > } >-sub db_max () { >+sub db_max { > my $self = shift; > my $query = "SELECT max(abs(barcode)) FROM items LIMIT 1"; # Possible problem if multiple barcode types populated > my $sth = C4::Context->dbh->prepare($query); > $sth->execute(); > return $sth->fetchrow_array || $self->initial; > } >-sub next_value ($;$) { >+sub next_value { > my $self = shift; > my $specific = (scalar @_) ? 1 : 0; > my $max = $specific ? shift : $self->max; # optional argument, i.e. next_value after X >@@ -143,22 +143,22 @@ sub next_value ($;$) { > $debug and print STDERR "( next ) max barcode found: $next_value\n"; > return $next_value; > } >-sub next ($;$) { >+sub next { > my $self = shift or return undef; > (@_) and $self->{next} = shift; > return $self->{next}; > } >-sub previous ($;$) { >+sub previous { > my $self = shift or return undef; > (@_) and $self->{previous} = shift; > return $self->{previous}; > } >-sub serial ($;$) { >+sub serial { > my $self = shift or return undef; > (@_) and $self->{serial} = shift; > return $self->{serial}; > } >-sub default_self (;$) { >+sub default_self { > (@_) or carp "default_self called with no argument. Reverting to _prefformat."; > my $autoBarcode = (@_) ? shift : _prefformat; > $autoBarcode =~ s/^.*:://; # in case we get C4::Barcodes::incremental, we just want 'incremental' >-- >1.7.2.5
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 6679
:
4883
|
4884
|
4885
|
4886
|
4887
|
4888
|
5445
|
5446
|
5483
|
5487
|
6121
|
6122
|
6123
|
6139
|
6140
|
6141
|
6142
|
6143
|
6144
|
6270
|
6271
|
6663
|
6670
|
6675
|
6676
|
6677
|
6678
|
8542
|
8897
|
8898
|
8899
|
8950
|
8951
|
9746
|
9747
|
9748
|
9749
|
9750
|
10050
|
10051
|
10052
|
10053
|
10054
|
10075
|
10076
|
10077
|
10078
|
10079
|
10484
|
10485
|
10486
|
10487
|
10488
|
10489
|
10491
|
10492
|
10493
|
10494
|
10495
|
10496
|
10497
|
10499
|
10500
|
10501
|
10502
|
10503
|
10504
|
10505
|
10506
|
10507
|
10508
|
10509
|
10510
|
10512
|
10513
|
10514
|
10515
|
10517
|
10521
|
10522
|
10523
|
10524
|
10525
|
10526
|
10527
|
10935
|
10936
|
10938
|
10940
|
10944
|
10945
|
10946
|
10947
|
10948
|
10949
|
10950
|
10952
|
10953
|
10955
|
10957
|
10958
|
10959
|
10960
|
10961
|
10962
|
10963
|
10964
|
10965
|
10966
|
10967
|
10972
|
10976
|
10979
|
10980
|
10981
|
12224
|
12363
|
12490
|
12491
|
12492
|
34191
|
34192
|
34193
|
34194
|
34195
|
34196
|
34197
|
39100
|
39101
|
39102
|
39392
|
39393
|
39394
|
39395
|
39396
|
39397
|
39398
|
42770
|
47086
|
47087
|
47088
|
47089
|
47090
|
47178
|
47179
|
47180
|
47181
|
47205
|
47206
|
47207
|
47208