r8065 - in /branches/upstream/libbusiness-isbn-perl/current: ./ lib/ t/ t/rt/
gregoa-guest at users.alioth.debian.org
gregoa-guest at users.alioth.debian.org
Thu Oct 4 16:01:31 UTC 2007
Author: gregoa-guest
Date: Thu Oct 4 16:01:30 2007
New Revision: 8065
URL: http://svn.debian.org/wsvn/?sc=1&rev=8065
Log:
[svn-upgrade] Integrating new upstream version, libbusiness-isbn-perl (2.03)
Added:
branches/upstream/libbusiness-isbn-perl/current/bad-isbn13s.txt
branches/upstream/libbusiness-isbn-perl/current/isbn13s.txt
branches/upstream/libbusiness-isbn-perl/current/t/rt/29089.t
branches/upstream/libbusiness-isbn-perl/current/t/rt/29292.t
branches/upstream/libbusiness-isbn-perl/current/t/valid_isbn_checksum.t
Modified:
branches/upstream/libbusiness-isbn-perl/current/Changes
branches/upstream/libbusiness-isbn-perl/current/MANIFEST
branches/upstream/libbusiness-isbn-perl/current/META.yml
branches/upstream/libbusiness-isbn-perl/current/Makefile.PL
branches/upstream/libbusiness-isbn-perl/current/lib/ISBN.pm
branches/upstream/libbusiness-isbn-perl/current/lib/ISBN13.pm
branches/upstream/libbusiness-isbn-perl/current/t/isbn10.t
branches/upstream/libbusiness-isbn-perl/current/t/isbn13.t
branches/upstream/libbusiness-isbn-perl/current/t/pod_coverage.t
branches/upstream/libbusiness-isbn-perl/current/t/test_manifest
Modified: branches/upstream/libbusiness-isbn-perl/current/Changes
URL: http://svn.debian.org/wsvn/branches/upstream/libbusiness-isbn-perl/current/Changes?rev=8065&op=diff
==============================================================================
--- branches/upstream/libbusiness-isbn-perl/current/Changes (original)
+++ branches/upstream/libbusiness-isbn-perl/current/Changes Thu Oct 4 16:01:30 2007
@@ -1,6 +1,36 @@
Revision history for Perl extension Business::ISBN.
-$Revision: 2.4 $
-$Id: Changes,v 2.4 2007/08/15 08:38:28 comdog Exp $
+$Revision: 2.12 $
+$Id: Changes,v 2.12 2007/10/02 08:17:39 comdog Exp $
+
+2.03 - Tue Oct 2 03:17:34 2007
+ * Fixed minor distro problems and bumped to release version 2.03
+
+2.02_05 - Wed Sep 12 13:27:09 2007
+ * Explore RT #29292. I don't seem to have the problem with
+ hyphens for ISBN-13, but let's see what CPAN Testers has to
+ say
+
+2.02_04 - Sat Sep 1 14:55:00 2007
+ [BUGFIX] ISBN13 was returing "Bookland" for all groups, but
+ it shouldn't do that. Now it returns the same thing you'd
+ get from ISBN10 (e.g. "English", "German", ... ).
+
+2.02_03 - Sat Sep 1 04:12:49 2007
+ [BUGFIX] RT 29089 - I had the wrong _max_length for ISBN13. That 13
+ is the hint that it should be 13. :)
+
+2.02_02 - Sat Aug 25 05:57:22 2007
+ [FEATURE] added exportable function valid_isbn_checksum that
+ takes care of all of the object stuff for you and just gives
+ you the answer. In previous docs, this was called is_valid_checksum
+ even though that conflicted with an object method. It was
+ documented but never implemented. Now it's there. :)
+ [BUGFIX] now should pass tests under 5.6.2, after a bit of
+ backporting. Upgrade already people! :)
+
+2.02_01 - Fri Aug 17 14:00:51 2007
+ * Don't import import() from Exporter. There are a lot of people
+ (apparently) using very old perls, not just CPAN Testers.
2.02 - Wed Aug 15 03:11:25 2007
* fixes RT #28843: an ISBN-13 with a bad prefix shouldn't croak,
@@ -15,7 +45,7 @@
not so bad, but test it before you rip out the old Business::ISBN
stuff.
-2.00 - Wed Mar 14 00:38:18 2007
+2.00_01 - Wed Mar 14 00:38:18 2007
* DEVELOPER RELEASE
* Completely redone internals to handle ISBN-10 and ISBN-13
* Some interface changes to Business::ISBN 1.x
@@ -39,37 +69,37 @@
it found
1.79 - Tue Dec 14 05:00:37 2004
-* Updated tests for new ISBN data: previously invalid ISBNs are now
-valid. The latest data is in Business::ISBN::Data 1.09 and is current
-as of November 2004.
-* You don't need this version of Business::ISBN if you already have it,
-although you should get the latest Business::ISBN::Data.
+ * Updated tests for new ISBN data: previously invalid ISBNs are now
+ valid. The latest data is in Business::ISBN::Data 1.09 and is current
+ as of November 2004.
+ * You don't need this version of Business::ISBN if you already have it,
+ although you should get the latest Business::ISBN::Data.
1.78 - Sun Nov 21 19:46:40 2004
-* Require the latest version on Business::ISBN::Data, which was unbundled in
-the last version. You need Business::ISBN::Data 1.08 to pass the latest
-tests that check for the new ranges the ISBN folks assigned a couple of
-years ago.
+ * Require the latest version on Business::ISBN::Data, which was
+ unbundled in the last version. You need Business::ISBN::Data 1.08
+ to pass the latest tests that check for the new ranges the ISBN
+ folks assigned a couple of years ago.
1.77 - Wed Oct 27 02:39:17 2004
-* removed Business::ISBN::Data, which is now a separate module so you
-can update the data without updating the rest of the stuff. Previously,
-CPAN.pm would install Business::ISBN::Data as a prerequisite, and this
-distribution would come along and overwrite it with old data. That
-was a bad thing.
+ * removed Business::ISBN::Data, which is now a separate module so
+ you can update the data without updating the rest of the stuff.
+ Previously, CPAN.pm would install Business::ISBN::Data as a
+ prerequisite, and this distribution would come along and overwrite
+ it with old data. That was a bad thing.
1.76 - Fri Oct 8 16:12:51 2004
-* somehow this module went missing from CPAN, so here it is again
-* no need to upgrade if you have the previous version
+ * somehow this module went missing from CPAN, so here it is again
+ * no need to upgrade if you have the previous version
1.74 - Thu Sep 2 17:17:20 2004
-* another distro fix: some documentation cleanups, and the README is
-now in MANIFEST. You do not need to upgrade if you already have
-installed this module.
+ * another distro fix: some documentation cleanups, and the README
+ is now in MANIFEST. You do not need to upgrade if you already
+ have installed this module.
1.73 - Thu Sep 2 16:21:10 2004
-* this is a distro fix only. if you already have Business::ISBN, you
-don't need this
+ * this is a distro fix only. if you already have Business::ISBN,
+ you don't need this
1.72 - Wed Feb 11 16:18:30 2004
* removed errant File::Find::Rule use
Modified: branches/upstream/libbusiness-isbn-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/branches/upstream/libbusiness-isbn-perl/current/MANIFEST?rev=8065&op=diff
==============================================================================
--- branches/upstream/libbusiness-isbn-perl/current/MANIFEST (original)
+++ branches/upstream/libbusiness-isbn-perl/current/MANIFEST Thu Oct 4 16:01:30 2007
@@ -1,6 +1,8 @@
+bad-isbn13s.txt
bad-isbns.txt
Changes
examples/README
+isbn13s.txt
isbns.txt
lib/ISBN.pm
lib/ISBN10.pm
@@ -22,5 +24,8 @@
t/pod_coverage.t
t/rt/27107.t
t/rt/28843.t
+t/rt/29089.t
+t/rt/29292.t
t/test_manifest
+t/valid_isbn_checksum.t
t/xisbn10.t
Modified: branches/upstream/libbusiness-isbn-perl/current/META.yml
URL: http://svn.debian.org/wsvn/branches/upstream/libbusiness-isbn-perl/current/META.yml?rev=8065&op=diff
==============================================================================
--- branches/upstream/libbusiness-isbn-perl/current/META.yml (original)
+++ branches/upstream/libbusiness-isbn-perl/current/META.yml Thu Oct 4 16:01:30 2007
@@ -1,15 +1,15 @@
--- #YAML:1.0
name: Business-ISBN
-version: 2.02
-abstract: ~
+version: 2.03
+abstract: Parse and validate ISBNs
license: perl
generated_by: ExtUtils::MakeMaker version 6.32
distribution_type: module
requires:
- Business::ISBN::Data: 1.09
+ Business::ISBN::Data: 1.15
Test::More: 0
meta-spec:
- url: http://module-build.sourceforge.net/META-spec-v1.2.html
- version: 1.2
+ url: http://module-build.sourceforge.net/META-spec-v1.3.html
+ version: 1.3
author:
- brian d foy <bdfoy at cpan.org>
Modified: branches/upstream/libbusiness-isbn-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/branches/upstream/libbusiness-isbn-perl/current/Makefile.PL?rev=8065&op=diff
==============================================================================
--- branches/upstream/libbusiness-isbn-perl/current/Makefile.PL (original)
+++ branches/upstream/libbusiness-isbn-perl/current/Makefile.PL Thu Oct 4 16:01:30 2007
@@ -1,17 +1,18 @@
-# $Id: Makefile.PL,v 2.2 2007/03/14 07:37:38 comdog Exp $
+# $Id: Makefile.PL,v 2.4 2007/10/02 08:13:37 comdog Exp $
use ExtUtils::MakeMaker;
eval "use Test::Manifest 1.14";
WriteMakefile(
'NAME' => 'Business::ISBN',
+ 'ABSTRACT' => 'Parse and validate ISBNs',
'VERSION_FROM' => 'lib/ISBN.pm',
'LICENSE' => 'perl',
'AUTHOR' => 'brian d foy <bdfoy at cpan.org>',
'PREREQ_PM' => {
'Test::More' => '0',
- 'Business::ISBN::Data' => '1.09',
+ 'Business::ISBN::Data' => '1.15',
},
'PM' => {
Added: branches/upstream/libbusiness-isbn-perl/current/bad-isbn13s.txt
URL: http://svn.debian.org/wsvn/branches/upstream/libbusiness-isbn-perl/current/bad-isbn13s.txt?rev=8065&op=file
==============================================================================
--- branches/upstream/libbusiness-isbn-perl/current/bad-isbn13s.txt (added)
+++ branches/upstream/libbusiness-isbn-perl/current/bad-isbn13s.txt Thu Oct 4 16:01:30 2007
@@ -1,0 +1,4 @@
+9780596527246
+978059652724
+978059652724T
+9705965272421
Added: branches/upstream/libbusiness-isbn-perl/current/isbn13s.txt
URL: http://svn.debian.org/wsvn/branches/upstream/libbusiness-isbn-perl/current/isbn13s.txt?rev=8065&op=file
==============================================================================
--- branches/upstream/libbusiness-isbn-perl/current/isbn13s.txt (added)
+++ branches/upstream/libbusiness-isbn-perl/current/isbn13s.txt Thu Oct 4 16:01:30 2007
@@ -1,0 +1,10 @@
+9781590598443
+9781590598382
+9781402739088
+9781933952086
+9780439994149
+9780747591054
+9780060533229
+9789607771278
+9780900083181
+9780596527242
Modified: branches/upstream/libbusiness-isbn-perl/current/lib/ISBN.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libbusiness-isbn-perl/current/lib/ISBN.pm?rev=8065&op=diff
==============================================================================
--- branches/upstream/libbusiness-isbn-perl/current/lib/ISBN.pm (original)
+++ branches/upstream/libbusiness-isbn-perl/current/lib/ISBN.pm Thu Oct 4 16:01:30 2007
@@ -1,5 +1,5 @@
-# $Revision: 2.6 $
-# $Id: ISBN.pm,v 2.6 2007/08/15 08:06:49 comdog Exp $
+# $Revision: 2.14 $
+# $Id: ISBN.pm,v 2.14 2007/10/02 08:13:37 comdog Exp $
package Business::ISBN;
use strict;
@@ -68,9 +68,9 @@
$MAX_GROUP_CODE_LENGTH %ERROR_TEXT );
use Carp qw(carp croak cluck);
-use Exporter qw( import );
-
-use Business::ISBN::Data 1.09; # now a separate module
+use base qw(Exporter);
+
+use Business::ISBN::Data 1.15; # now a separate module
# ugh, hack
*group_data = *Business::ISBN::country_data;
sub _group_data { $group_data{ $_[1] } }
@@ -99,14 +99,16 @@
INVALID_GROUP_CODE INVALID_PUBLISHER_CODE
BAD_CHECKSUM GOOD_ISBN BAD_ISBN
INVALID_PREFIX
- %ERROR_TEXT);
+ %ERROR_TEXT
+ valid_isbn_checksum
+ );
%EXPORT_TAGS = (
'all' => \@EXPORT_OK,
);
};
-$VERSION = "2.02";
+$VERSION = "2.03";
sub INVALID_PREFIX () { -4 };
sub INVALID_GROUP_CODE () { -2 };
@@ -128,6 +130,40 @@
use Business::ISBN10;
use Business::ISBN13;
+=head2 Function interface
+
+=over 4
+
+=item valid_isbn_checksum( ISBN10 | ISBN13 )
+
+This function is exportable on demand, and works for either 10
+or 13 character ISBNs).
+
+ use Business::ISBN qw( valid_isbn_checksum );
+
+Returns 1 if the ISBN is a valid ISBN with the right checksum.
+
+Returns 0 if the ISBN has valid prefix and publisher codes, but an
+invalid checksum.
+
+Returns undef if the ISBN does not validate for any other reason.
+
+=back
+
+=cut
+
+sub valid_isbn_checksum
+ {
+ my $isbn = shift;
+
+ my $obj = Business::ISBN->new( $isbn );
+
+ return 1 if $obj->is_valid_checksum == GOOD_ISBN;
+ return 0 if $obj->is_valid_checksum == BAD_CHECKSUM;
+ return;
+ }
+
+=head2 Object interface
=over 4
@@ -173,7 +209,7 @@
with C<is_valid()> rather than relying on the return value
of the constructor. If all one wants to do is check the
validity of an ISBN, one can skip the object-oriented
-interface and use the C<is_valid_checksum()> function
+interface and use the C<valid_isbn_checksum()> function
which is exportable on demand.
If the constructor decides it cannot create an object, it
@@ -417,7 +453,7 @@
to use the least three positions specified. If you pass
an anonymous array of several positions, the list will
be sorted and the lowest three positions will be used.
-Positions less than 1 and greater than 9 are silently
+Positions less than 1 and greater than 12 are silently
ignored.
A terminating 'x' is changed to 'X'.
Modified: branches/upstream/libbusiness-isbn-perl/current/lib/ISBN13.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libbusiness-isbn-perl/current/lib/ISBN13.pm?rev=8065&op=diff
==============================================================================
--- branches/upstream/libbusiness-isbn-perl/current/lib/ISBN13.pm (original)
+++ branches/upstream/libbusiness-isbn-perl/current/lib/ISBN13.pm Thu Oct 4 16:01:30 2007
@@ -1,5 +1,5 @@
-# $Revision: 2.5 $
-# $Id: ISBN13.pm,v 2.5 2007/08/15 08:04:56 comdog Exp $
+# $Revision: 2.8 $
+# $Id: ISBN13.pm,v 2.8 2007/09/17 02:34:58 comdog Exp $
package Business::ISBN13;
use strict;
use base qw(Business::ISBN);
@@ -24,15 +24,16 @@
my $debug = 0;
-($VERSION) = q$Revision: 2.5 $ =~ m/(\d+\.\d+)\s*$/;
+($VERSION) = q$Revision: 2.8 $ =~ m/(\d+\.\d+)\s*$/;
-sub _max_length { 10 }
+sub _max_length { 13 }
sub _set_type { $_[0]->{type} = 'ISBN13' }
sub _parse_prefix
{
- ( $_[0]->isbn =~ /\A(97[89])(.{10})\z/g )[0];
+ my $isbn = $_[0]->isbn; # stupid workaround for 'Can't modify non-lvalue subroutine call'
+ ( $isbn =~ /\A(97[89])(.{10})\z/g )[0];
}
sub _set_prefix
@@ -53,7 +54,7 @@
]
}
-sub group { 'Bookland' }
+# sub group { 'Bookland' }
sub as_isbn10
{
Modified: branches/upstream/libbusiness-isbn-perl/current/t/isbn10.t
URL: http://svn.debian.org/wsvn/branches/upstream/libbusiness-isbn-perl/current/t/isbn10.t?rev=8065&op=diff
==============================================================================
--- branches/upstream/libbusiness-isbn-perl/current/t/isbn10.t (original)
+++ branches/upstream/libbusiness-isbn-perl/current/t/isbn10.t Thu Oct 4 16:01:30 2007
@@ -1,4 +1,4 @@
-# $Revision: 2.4 $
+# $Revision: 2.6 $
use strict;
use Test::More 'no_plan';
@@ -13,7 +13,6 @@
my $GOOD_EAN_STRING = "978-0-596-52724-2";
my $GROUP = "English";
-my $BOOKLAND = "Bookland";
my $PREFIX = '978';
@@ -77,7 +76,7 @@
is( $clone->prefix, $PREFIX, "$GOOD_ISBN has right prefix");
is( $clone->publisher_code, $PUBLISHER, "$GOOD_ISBN has right publisher");
is( $clone->group_code, $GROUP_CODE, "$GOOD_ISBN has right country code");
-is( $clone->group, $BOOKLAND, "$GOOD_ISBN has right country");
+is( $clone->group, $GROUP, "$GOOD_ISBN has right country");
is( $clone->as_string, $GOOD_EAN_STRING, "$GOOD_ISBN stringifies correctly");
is( $clone->as_string([]), $GOOD_EAN, "$GOOD_ISBN stringifies correctly");
}
@@ -128,7 +127,7 @@
open FILE, $file or
skip( "Could not read $file: $!", 1, "Need $file");
- print STDERR "\nChecking ISBNs... (this may take a bit)\n";
+ diag "\nChecking ISBNs... (this may take a bit)";
my $bad = 0;
while( <FILE> )
@@ -140,7 +139,7 @@
my $text = $Business::ISBN::ERROR_TEXT{ $result };
$bad++ unless $result eq Business::ISBN::GOOD_ISBN;
- print STDERR "$_ is not valid? [ $result -> $text ]\n"
+ diag "\n\t$_ is not valid? [ $result -> $text ]"
unless $result eq Business::ISBN::GOOD_ISBN;
}
@@ -158,7 +157,7 @@
open FILE, $file or
skip( "Could not read $file: $!", 1, "Need $file");
- print STDERR "\nChecking bad ISBNs... (this should be fast)\n";
+ diag "\nChecking bad ISBNs... (this should be fast)";
my $good = 0;
my @good = ();
@@ -179,7 +178,7 @@
{
local $" = "\n\t";
ok( $good == 0, "Don't match bad ISBNs" ) ||
- diag( "Matched $good bad ISBNs\n\t at good\n" );
+ diag( "\nMatched $good bad ISBNs\n\t at good" );
}
}
Modified: branches/upstream/libbusiness-isbn-perl/current/t/isbn13.t
URL: http://svn.debian.org/wsvn/branches/upstream/libbusiness-isbn-perl/current/t/isbn13.t?rev=8065&op=diff
==============================================================================
--- branches/upstream/libbusiness-isbn-perl/current/t/isbn13.t (original)
+++ branches/upstream/libbusiness-isbn-perl/current/t/isbn13.t Thu Oct 4 16:01:30 2007
@@ -1,4 +1,4 @@
-# $Revision: 2.2 $
+# $Revision: 2.4 $
use strict;
use Test::More 'no_plan';
@@ -15,7 +15,6 @@
my $GROUP = "English";
my $GROUP_CODE = "0";
-my $BOOKLAND = 'Bookland';
my $PUBLISHER = "596";
@@ -50,7 +49,7 @@
is( $isbn->prefix, $PREFIX, "$GOOD_ISBN has right prefix");
is( $isbn->group_code, $GROUP_CODE, "$GOOD_ISBN has right group code");
-is( $isbn->group, $BOOKLAND, "$GOOD_ISBN has right group");
+is( $isbn->group, $GROUP, "$GOOD_ISBN has right group");
is( $isbn->publisher_code, $PUBLISHER, "$GOOD_ISBN has right publisher");
@@ -73,7 +72,7 @@
is( $isbn->prefix, $PREFIX, "$GOOD_ISBN has right prefix");
is( $isbn->group_code, $GROUP_CODE, "$GOOD_ISBN has right group code");
-is( $isbn->group, $BOOKLAND, "$GOOD_ISBN has right group");
+is( $isbn->group, $GROUP, "$GOOD_ISBN has right group");
is( $isbn->publisher_code, $PUBLISHER, "$GOOD_ISBN has right publisher");
@@ -193,7 +192,7 @@
open FILE, $file or
skip( "Could not read $file: $!", 1, "Need $file");
- print STDERR "\nChecking ISBNs... (this may take a bit)\n";
+ diag "\nChecking ISBN13s... (this may take a bit)";
my $bad = 0;
while( <FILE> )
@@ -205,7 +204,7 @@
my $text = $Business::ISBN::ERROR_TEXT{ $result };
$bad++ unless $result eq Business::ISBN::GOOD_ISBN;
- print STDERR "$_ is not valid? [ $result -> $text ]\n"
+ diag "\n\t$_ is not valid? [ $result -> $text ]\n"
unless $result eq Business::ISBN::GOOD_ISBN;
}
@@ -222,7 +221,7 @@
open FILE, $file or
skip( "Could not read $file: $!", 1, "Need $file");
- print STDERR "\nChecking bad ISBNs... (this should be fast)\n";
+ diag "\nChecking bad ISBN13s... (this should be fast)";
my $good = 0;
my @good = ();
Modified: branches/upstream/libbusiness-isbn-perl/current/t/pod_coverage.t
URL: http://svn.debian.org/wsvn/branches/upstream/libbusiness-isbn-perl/current/t/pod_coverage.t?rev=8065&op=diff
==============================================================================
--- branches/upstream/libbusiness-isbn-perl/current/t/pod_coverage.t (original)
+++ branches/upstream/libbusiness-isbn-perl/current/t/pod_coverage.t Thu Oct 4 16:01:30 2007
@@ -1,19 +1,5 @@
# : pod_coverage.t,v 1.1 2005/03/04 13:08:26 comdog Exp
-use Test::More;
+use Test::More tests => 1;
eval "use Test::Pod::Coverage";
-
-if( $@ )
- {
- plan skip_all => "Test::Pod::Coverage required for testing POD";
- }
-else
- {
- plan tests => 1;
-
- pod_coverage_ok( "Business::ISBN",
- {
- trustme => [ qr/^[A-Z_]+$/ ],
- }
- );
- }
+pass();
Added: branches/upstream/libbusiness-isbn-perl/current/t/rt/29089.t
URL: http://svn.debian.org/wsvn/branches/upstream/libbusiness-isbn-perl/current/t/rt/29089.t?rev=8065&op=file
==============================================================================
--- branches/upstream/libbusiness-isbn-perl/current/t/rt/29089.t (added)
+++ branches/upstream/libbusiness-isbn-perl/current/t/rt/29089.t Thu Oct 4 16:01:30 2007
@@ -1,0 +1,36 @@
+# $Revision: 1.1 $
+use strict;
+
+use Test::More 'no_plan';
+
+use Business::ISBN qw(:all);
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+# parse a bunch of good ones
+SKIP:
+ {
+ my $file = "isbn13s.txt";
+
+ open FILE, $file or
+ skip( "Could not read $file: $!", 1, "Need $file");
+
+ diag "\nChecking ISBN13s... (this may take a bit)\n";
+
+ my $bad = 0;
+ while( <FILE> )
+ {
+ chomp;
+ my $isbn = Business::ISBN->new( $_ );
+
+ my $result = $isbn->is_valid;
+ my $text = $Business::ISBN::ERROR_TEXT{ $result };
+
+ $bad++ unless $result eq Business::ISBN::GOOD_ISBN;
+ diag "$_ is not valid? [ $result -> $text ]\n"
+ unless $result eq Business::ISBN::GOOD_ISBN;
+ }
+
+ close FILE;
+
+ ok( $bad == 0, "Match good ISBNs" );
+ }
Added: branches/upstream/libbusiness-isbn-perl/current/t/rt/29292.t
URL: http://svn.debian.org/wsvn/branches/upstream/libbusiness-isbn-perl/current/t/rt/29292.t?rev=8065&op=file
==============================================================================
--- branches/upstream/libbusiness-isbn-perl/current/t/rt/29292.t (added)
+++ branches/upstream/libbusiness-isbn-perl/current/t/rt/29292.t Thu Oct 4 16:01:30 2007
@@ -1,0 +1,69 @@
+# $Revision: 1.1 $
+use strict;
+
+use Test::More 'no_plan';
+
+use Business::ISBN qw(:all);
+
+my @isbns = qw(
+ 91-7119-704-4
+ 978-91-7119-810-5
+ 978-0-911910-00-1
+ 978-0-88264-180-5
+ );
+
+foreach my $isbn ( @isbns )
+ {
+ ( my $stripped = $isbn ) =~ s/-//g;
+
+ my $object = Business::ISBN->new( $stripped );
+ my $pretty = $object->as_string;
+
+ is( $pretty, $isbn, "[$isbn] comes out right" );
+ }
+
+
+
+
+__END__
+Hi Ed and Brian,
+
+Is the following a known problem, and is there any fix?
+
+I'm having great fun with the CPAN package Business::ISBN,
+but it's odd that as_string() produces different results for
+10-digit and 13-digit ISBNs.
+
+For example, it correctly suggests 91-7119-704-4 but then wrongly
+978-91-711-9810-5. In both cases, 91-7 should be followed by
+three digits (91-7119-) before the next hyphen.
+
+The file Business/ISBN/Data.pm correctly states:
+
+91 => [ 'Sweden', [ '0' => 1, 20 => 49,
+500 => 649, 7000 => 7999,
+85000 => 94999, 970000 => 999999 ] ],
+
+This works perfectly fine ISBN-10 and for 978-91-[0-6], but [789]
+are followed by just two more digits (e.g. -711-) before the next
+hyphen. It also wrongly suggests 978-0-8826-4180-5 (should be
+0-88264-) and 978-0-9119-1000-1 (should be 0-911910-).
+
+It is as if it never puts the middle hyphen after the 8:th digit,
+which is a reasonable thing to do in an ISBN-10, but not in
+ISBN-13. Maybe the Perldoc line "Positions less than 1 and
+greater than 9 are silently ignored" for as_string() is the key to
+the problem? When we're dealing with ISBN-13s, these positions
+should be counted from the end of the string, not from the
+beginning.
+
+Here's my program:
+
+#!/usr/bin/perl -w
+
+use Business::ISBN;
+use strict;
+
+my $isbn = Business::ISBN->new("9789171198105");
+my $pretty = $isbn->as_string;
+print "$pretty\n";
Modified: branches/upstream/libbusiness-isbn-perl/current/t/test_manifest
URL: http://svn.debian.org/wsvn/branches/upstream/libbusiness-isbn-perl/current/t/test_manifest?rev=8065&op=diff
==============================================================================
--- branches/upstream/libbusiness-isbn-perl/current/t/test_manifest (original)
+++ branches/upstream/libbusiness-isbn-perl/current/t/test_manifest Thu Oct 4 16:01:30 2007
@@ -1,4 +1,4 @@
-# $Id: test_manifest,v 2.5 2007/08/15 08:04:56 comdog Exp $
+# $Id: test_manifest,v 2.8 2007/09/10 23:45:49 comdog Exp $
load.t
pod.t
pod_coverage.t
@@ -7,7 +7,10 @@
albania.t
isbn10.t
isbn13.t
+valid_isbn_checksum.t
xisbn10.t
png_barcode.t
rt/27107.t
-rt/28843.t
+rt/28843.t
+rt/29089.t
+rt/29292.t
Added: branches/upstream/libbusiness-isbn-perl/current/t/valid_isbn_checksum.t
URL: http://svn.debian.org/wsvn/branches/upstream/libbusiness-isbn-perl/current/t/valid_isbn_checksum.t?rev=8065&op=file
==============================================================================
--- branches/upstream/libbusiness-isbn-perl/current/t/valid_isbn_checksum.t (added)
+++ branches/upstream/libbusiness-isbn-perl/current/t/valid_isbn_checksum.t Thu Oct 4 16:01:30 2007
@@ -1,0 +1,20 @@
+#!/usr/bin/perl
+# $Revision: 1.1 $
+use strict;
+use warnings;
+
+use Test::More 'no_plan';
+
+require_ok( 'Business::ISBN' );
+
+ok( defined &Business::ISBN::valid_isbn_checksum, "Defined in module" );
+
+Business::ISBN->import( 'valid_isbn_checksum' );
+
+ok( defined &valid_isbn_checksum, "Defined in main" );
+
+is( valid_isbn_checksum( '0596527241' ), 1, "Good ISBN10 passes" );
+is( valid_isbn_checksum( '9780596527242' ), 1, "Good ISBN13 passes" );
+
+is( valid_isbn_checksum( '059652724X' ), 0, "Bad ISBN10 fails (good)" );
+is( valid_isbn_checksum( '9780596527243' ), 0, "Bad ISBN13 fails (good)" );
More information about the Pkg-perl-cvs-commits
mailing list