bug 2505: enable warnings in C4/Input.pm
authorGalen Charlton <galen.charlton@liblime.com>
Sun, 7 Jun 2009 22:02:47 +0000 (10:02 +1200)
committerGalen Charlton <galen.charlton@liblime.com>
Mon, 8 Jun 2009 01:09:20 +0000 (20:09 -0500)
Also removed POD containing disused function
checkvalidisbn.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
C4/Input.pm

index 6f0173d..8dd13f1 100644 (file)
@@ -19,6 +19,8 @@ package C4::Input; #assumes C4/Input
 # Suite 330, Boston, MA  02111-1307 USA
 
 use strict;
+use warnings;
+
 require Exporter;
 use C4::Context;
 use CGI;
@@ -49,7 +51,7 @@ number or ISBN is valid.
 
 @ISA = qw(Exporter);
 @EXPORT = qw(
-       &checkdigit &checkvalidisbn
+       &checkdigit
        &buildCGIsort
 );
 
@@ -107,32 +109,6 @@ sub checkdigit ($;$) {
        return 0;
 } # sub checkdigit
 
-=item checkvalidisbn           # Obsolete Function!
-
-  $valid = &checkvalidisbn($isbn);
-
-Returns a true value iff C<$isbn> is a valid ISBN: it must be ten
-digits long (counting "X" as a digit), and must have a valid check
-digit at the end.
-
-sub checkvalidisbn ($) {       # Obsolete Function!
-       my ($q) = shift or return undef;
-       $q=~s/[^Xx\d]//g;
-        /(\d{9})(X|\d)/i or
-       /(\d{12})(X|\d)/i or return 0; 
-       my $checksum = $2;
-       my $isbn     = $1;
-       my $c = 0;
-       my $max = length $isbn;
-       for (my $i=0; $i<$max; $i++) {
-               my $digit=substr($q,$i,1);
-               $c+=$digit*(10-$i);
-       }
-       $c %= 11;
-       ($c==10) and $c = 'X';
-       return ($c eq $checksum) ? 1 : 0;
-}
-
 =item buildCGISort
 
   $CGIScrollingList = &buildCGISort($name string, $input_name string);