Skip Menu |

This queue is for tickets about the Business-UPC CPAN distribution.

Report information
The Basics
Id: 2509
Status: new
Priority: 0/
Queue: Business-UPC

People
Owner: Nobody in particular
Requestors: dom [...] semantico.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: (no value)



Subject: warnings from Business::UPC::_check_digit
In the function _check_digit, a warning is emitted when run under "perl -w". The attached patch fixes this, and adds a test for it. Thanks for a useful module, -Dom
diff -urN Business-UPC-0.02/UPC.pm Business-UPC-0.02-fixed/UPC.pm --- Business-UPC-0.02/UPC.pm 1998-11-04 20:19:04.000000000 +0000 +++ Business-UPC-0.02-fixed/UPC.pm 2003-05-06 14:43:50.000000000 +0100 @@ -173,6 +173,9 @@ my @digits = split(//, $num); + # To avoid warning when summing below. + push @digits, 0; + my $sum = 0; foreach my $i (0, 2, 4, 6, 8, 10) diff -urN Business-UPC-0.02/test.pl Business-UPC-0.02-fixed/test.pl --- Business-UPC-0.02/test.pl 1998-11-04 20:17:57.000000000 +0000 +++ Business-UPC-0.02-fixed/test.pl 2003-05-06 14:40:47.000000000 +0100 @@ -111,4 +111,14 @@ print "ok 28\n"; +# Test for warnings... +{ + my $err; + local $^W = 1; + local $SIG{ __WARN__ } = sub { $err = "@_" }; + $upc = new Business::UPC('512345678900'); + $upc->fix_check_digit; + print "not " if $err; + print "ok 29\n"; +}