Bug 6679 - [SIGNED-OFF] fix 6 perlcritic violations in C4/Barcodes/hbyymmincr.pm
authorMason James <mtj@kohaaloha.com>
Tue, 26 Jun 2012 13:53:05 +0000 (01:53 +1200)
committerPaul Poulain <paul.poulain@biblibre.com>
Thu, 20 Sep 2012 10:01:36 +0000 (12:01 +0200)
- Subroutine prototypes used at line 45, column 1.  See page 194 of PBP.  (Severity: 5)

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
C4/Barcodes/hbyymmincr.pm

index ca3149f..258a1a5 100644 (file)
@@ -42,7 +42,7 @@ INIT {
 # Generates barcode where hb = home branch Code, yymm = year/month catalogued, incr = incremental number,
 #      increment resets yearly -fbcit
 
-sub db_max ($;$) {
+sub db_max {
        my $self = shift;
        my $query = "SELECT MAX(SUBSTRING(barcode,-$width)), barcode FROM items WHERE barcode REGEXP ? GROUP BY barcode";
        $debug and print STDERR "(hbyymmincr) db_max query: $query\n";
@@ -71,14 +71,14 @@ sub db_max ($;$) {
        return ($max || 0);
 }
 
-sub initial () {
+sub initial {
        my $self = shift;
        # FIXME: populated branch?
        my $iso = C4::Dates->new->output('iso');        # like "2008-07-02"
        return $self->branch . substr($iso,2,2) . substr($iso,5,2) . sprintf('%' . "$width.$width" . 'd',1);
 }
 
-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;
        my $branch = $self->branch;
@@ -90,17 +90,17 @@ sub parse ($;$) {   # return 3 parts of barcode: non-incrementing, incrementing,
        return ($1,$2,'');  # the third part is in anticipation of barcodes that include checkdigits
 }
 
-sub branch ($;$) {
+sub branch {
        my $self = shift;
        (@_) and $self->{branch} = shift;
        return $self->{branch};
 }
-sub width ($;$) {
+sub width {
        my $self = shift;
        (@_) and $width = shift;        # hitting the class variable.
        return $width;
 }
-sub process_head($$;$$) {      # (self,head,whole,specific)
+sub process_head {     # (self,head,whole,specific)
        my ($self,$head,$whole,$specific) = @_;
        $specific and return $head;     # if this is built off an existing barcode, just return the head unchanged.
        $head =~ s/\d{4}$//;            # else strip the old yymm