diff -Nru libbusiness-isbn-perl-2.010/Changes libbusiness-isbn-perl-3.004/Changes --- libbusiness-isbn-perl-2.010/Changes 2015-12-15 07:37:24.000000000 +0000 +++ libbusiness-isbn-perl-3.004/Changes 2017-04-24 20:04:32.000000000 +0000 @@ -1,8 +1,38 @@ Revision history for Perl module Business::ISBN +3.004 2017-04-24T20:02:52Z + * Remove Mojo dependencies after splitting out Business::xISBN + (Michiel Beijen) + * Remove unneeded code from the checksumming stuff (Mike O'Regan) + * We now test on Windows through AppVeyor + +3.003 2016-09-19T22:03:24Z + * Clarify everywhere that I'm using Artistic License 2.0 + +3.002 2016-08-10T09:30:21Z + * Bump to stable versions + +3.001_01 2016-08-06T08:14:59Z + * Remove xisbn stuff–it's due to be turned off. + * Bump the major version for the API change + +2.011_01 2016-07-29T20:50:01Z + * Remove the URI prereq + +2.011 2016-06-07T18:20:50Z + * bump to stable release + +2.010_01 2016-03-28T03:45:17Z + * Had error_* methods to get the error text and check the error + conditions so you don't have to use %ERROR_TEXT or the constants. + * Deprecate the xisbn stuff. It's still there, but it should have + disappeared about two weeks ago. + * Add an example of inserting an unofficial group code for the + Blake and Taylor shenanigans. + 2.010 2015-12-15T07:35:57Z * Sync latest dependencies in build and module files - * Promote to a developer release + * Promote to a stable release 2.09_02 - Mon Aug 31 02:24:10 2015 * Have a simple fallback for parsing XML if Mojo::DOM isn't there diff -Nru libbusiness-isbn-perl-2.010/debian/changelog libbusiness-isbn-perl-3.004/debian/changelog --- libbusiness-isbn-perl-2.010/debian/changelog 2016-02-18 16:35:18.000000000 +0000 +++ libbusiness-isbn-perl-3.004/debian/changelog 2021-03-19 21:59:49.000000000 +0000 @@ -1,17 +1,56 @@ -libbusiness-isbn-perl (2.010-1ubuntu2) xenial; urgency=medium +libbusiness-isbn-perl (3.004-1~16.04.sav0) xenial; urgency=medium - * debian/control: Also swap around the binary dependency so that - libmojolicious-perl is not preferred and clutters up component-mismatches. + * Backport to Xenial - -- Martin Pitt Thu, 18 Feb 2016 17:34:53 +0100 + -- Rob Savoury Fri, 19 Mar 2021 14:59:49 -0700 -libbusiness-isbn-perl (2.010-1ubuntu1) xenial; urgency=medium +libbusiness-isbn-perl (3.004-1) unstable; urgency=medium - * Remove build-dependency on libmojolicious-perl; it's not worth pulling - all this into main just for a test. Add it to the dependencies of the - "smoke" autopkgtest instead. + * Import upstream version 3.004. + * Update years of upstream and packaging copyright. + * Drop (build) dependency on libmojolicious-perl. + * Declare compliance with Debian Policy 4.1.1. + * Really drop debian/tests/pkg-perl/smoke-skip, as announced in the previous + package version. - -- Colin Watson Tue, 29 Dec 2015 04:24:53 +0000 + -- gregor herrmann Sat, 14 Oct 2017 15:45:47 +0200 + +libbusiness-isbn-perl (3.003-1) unstable; urgency=medium + + * Team upload. + + [ gregor herrmann ] + * Remove Rene Mayorga from Uploaders. Thanks for your work! + + [ Nuno Carvalho ] + * Import upstream version 3.003. + * debian/copyright: + + update copyright years. + + update license to Artistic 2.0. + * debian/control: drop dependency liburi-perl, no longer required. + * Add debian/NEWS files. + * debian/rules: simplify file, no longer required to skip tests. + * debian/tests/pkg-perl/smoke-skip: drop file, no longer required to skip + tests. + + -- Nuno Carvalho Thu, 06 Oct 2016 17:22:16 +0100 + +libbusiness-isbn-perl (2.011-1) unstable; urgency=medium + + [ Salvatore Bonaccorso ] + * debian/control: Use HTTPS transport protocol for Vcs-Git URI + + [ gregor herrmann ] + * debian/copyright: change Copyright-Format 1.0 URL to HTTPS. + * Import upstream version 2.011. + * Update years of packaging copyright. + * Install new example script. + * Use HTTPS for Homepage in debian/control. Thanks to duck. + * Skip tests which tries to connect to the internet during build and + autopkgtest. + * Declare compliance with Debian Policy 3.9.8. + + -- gregor herrmann Wed, 20 Jul 2016 19:11:50 +0200 libbusiness-isbn-perl (2.010-1) unstable; urgency=medium diff -Nru libbusiness-isbn-perl-2.010/debian/control libbusiness-isbn-perl-3.004/debian/control --- libbusiness-isbn-perl-2.010/debian/control 2016-02-18 16:34:46.000000000 +0000 +++ libbusiness-isbn-perl-3.004/debian/control 2017-10-14 13:45:47.000000000 +0000 @@ -1,10 +1,9 @@ Source: libbusiness-isbn-perl -Maintainer: Ubuntu Developers -XSBC-Original-Maintainer: Debian Perl Group +Maintainer: Debian Perl Group Uploaders: Vincent Danjean , - gregor herrmann , - Rene Mayorga + gregor herrmann Section: perl +Testsuite: autopkgtest-pkg-perl Priority: optional Build-Depends: debhelper (>= 9) Build-Depends-Indep: perl, @@ -12,24 +11,20 @@ libgd-barcode-perl, libtest-pod-coverage-perl, libtest-pod-perl, - liburi-perl, libwww-perl -Standards-Version: 3.9.6 +Standards-Version: 4.1.1 Vcs-Browser: https://anonscm.debian.org/cgit/pkg-perl/packages/libbusiness-isbn-perl.git -Vcs-Git: git://anonscm.debian.org/pkg-perl/packages/libbusiness-isbn-perl.git -Homepage: http://sourceforge.net/projects/perl-isbn/ -Testsuite: autopkgtest-pkg-perl +Vcs-Git: https://anonscm.debian.org/git/pkg-perl/packages/libbusiness-isbn-perl.git +Homepage: https://sourceforge.net/projects/perl-isbn/ Package: libbusiness-isbn-perl Architecture: all Depends: ${perl:Depends}, ${misc:Depends}, libbusiness-isbn-data-perl (>= 20140910.002), - libwww-perl | libmojolicious-perl, - liburi-perl + libwww-perl Suggests: libgd-barcode-perl Description: Perl library to work with International Standard Book Numbers Business::ISBN allows one to easily extract useful information from ISBN such as country code, publisher code, ... It allows one to check the checksum and/or correct it. - diff -Nru libbusiness-isbn-perl-2.010/debian/copyright libbusiness-isbn-perl-3.004/debian/copyright --- libbusiness-isbn-perl-2.010/debian/copyright 2015-12-23 17:10:39.000000000 +0000 +++ libbusiness-isbn-perl-3.004/debian/copyright 2017-10-14 13:45:47.000000000 +0000 @@ -1,14 +1,14 @@ -Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: Business-ISBN Source: https://metacpan.org/release/Business-ISBN Upstream-Contact: brian d foy Files: * -Copyright: 2001-2015, brian d foy -License: Artistic or GPL-1+ +Copyright: 2001-2017, brian d foy +License: Artistic-2.0 Files: debian/* -Copyright: 2007-2015, gregor herrmann +Copyright: 2007-2017, gregor herrmann 2007, Vincent Danjean 2009, Nathan Handler 2009, Rene Mayorga @@ -29,3 +29,206 @@ . On Debian systems, the complete text of version 1 of the GNU General Public License can be found in `/usr/share/common-licenses/GPL-1'. + +License: Artistic-2.0 + The Artistic License 2.0 + . + Copyright (c) 2000-2006, The Perl Foundation. + . + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + . + Preamble + . + This license establishes the terms under which a given free software + Package may be copied, modified, distributed, and/or redistributed. + The intent is that the Copyright Holder maintains some artistic + control over the development of that Package while still keeping the + Package available as open source and free software. + . + You are always permitted to make arrangements wholly outside of this + license directly with the Copyright Holder of a given Package. If the + terms of this license do not permit the full use that you propose to + make of the Package, you should contact the Copyright Holder and seek + a different licensing arrangement. + . + Definitions + . + "Copyright Holder" means the individual(s) or organization(s) + named in the copyright notice for the entire Package. + . + "Contributor" means any party that has contributed code or other + material to the Package, in accordance with the Copyright Holder's + procedures. + . + "You" and "your" means any person who would like to copy, + distribute, or modify the Package. + . + "Package" means the collection of files distributed by the + Copyright Holder, and derivatives of that collection and/or of + those files. A given Package may consist of either the Standard + Version, or a Modified Version. + . + "Distribute" means providing a copy of the Package or making it + accessible to anyone else, or in the case of a company or + organization, to others outside of your company or organization. + . + "Distributor Fee" means any fee that you charge for Distributing + this Package or providing support for this Package to another + party. It does not mean licensing fees. + . + "Standard Version" refers to the Package if it has not been + modified, or has been modified only in ways explicitly requested + by the Copyright Holder. + . + "Modified Version" means the Package, if it has been changed, and + such changes were not explicitly requested by the Copyright + Holder. + . + "Original License" means this Artistic License as Distributed with + the Standard Version of the Package, in its current version or as + it may be modified by The Perl Foundation in the future. + . + "Source" form means the source code, documentation source, and + configuration files for the Package. + . + "Compiled" form means the compiled bytecode, object code, binary, + or any other form resulting from mechanical transformation or + translation of the Source form. + . + . + Permission for Use and Modification Without Distribution + . + (1) You are permitted to use the Standard Version and create and use + Modified Versions for any purpose without restriction, provided that + you do not Distribute the Modified Version. + . + . + Permissions for Redistribution of the Standard Version + . + (2) You may Distribute verbatim copies of the Source form of the + Standard Version of this Package in any medium without restriction, + either gratis or for a Distributor Fee, provided that you duplicate + all of the original copyright notices and associated disclaimers. At + your discretion, such verbatim copies may or may not include a + Compiled form of the Package. + . + (3) You may apply any bug fixes, portability changes, and other + modifications made available from the Copyright Holder. The resulting + Package will still be considered the Standard Version, and as such + will be subject to the Original License. + . + . + Distribution of Modified Versions of the Package as Source + . + (4) You may Distribute your Modified Version as Source (either gratis + or for a Distributor Fee, and with or without a Compiled form of the + Modified Version) provided that you clearly document how it differs + from the Standard Version, including, but not limited to, documenting + any non-standard features, executables, or modules, and provided that + you do at least ONE of the following: + . + (a) make the Modified Version available to the Copyright Holder + of the Standard Version, under the Original License, so that the + Copyright Holder may include your modifications in the Standard + Version. + . + (b) ensure that installation of your Modified Version does not + prevent the user installing or running the Standard Version. In + addition, the Modified Version must bear a name that is different + from the name of the Standard Version. + . + (c) allow anyone who receives a copy of the Modified Version to + make the Source form of the Modified Version available to others + under + . + (i) the Original License or + . + (ii) a license that permits the licensee to freely copy, + modify and redistribute the Modified Version using the same + licensing terms that apply to the copy that the licensee + received, and requires that the Source form of the Modified + Version, and of any works derived from it, be made freely + available in that license fees are prohibited but Distributor + Fees are allowed. + . + . + Distribution of Compiled Forms of the Standard Version + or Modified Versions without the Source + . + (5) You may Distribute Compiled forms of the Standard Version without + the Source, provided that you include complete instructions on how to + get the Source of the Standard Version. Such instructions must be + valid at the time of your distribution. If these instructions, at any + time while you are carrying out such distribution, become invalid, you + must provide new instructions on demand or cease further distribution. + If you provide valid instructions or cease distribution within thirty + days after you become aware that the instructions are invalid, then + you do not forfeit any of your rights under this license. + . + (6) You may Distribute a Modified Version in Compiled form without + the Source, provided that you comply with Section 4 with respect to + the Source of the Modified Version. + . + . + Aggregating or Linking the Package + . + (7) You may aggregate the Package (either the Standard Version or + Modified Version) with other packages and Distribute the resulting + aggregation provided that you do not charge a licensing fee for the + Package. Distributor Fees are permitted, and licensing fees for other + components in the aggregation are permitted. The terms of this license + apply to the use and Distribution of the Standard or Modified Versions + as included in the aggregation. + . + (8) You are permitted to link Modified and Standard Versions with + other works, to embed the Package in a larger work of your own, or to + build stand-alone binary or bytecode versions of applications that + include the Package, and Distribute the result without restriction, + provided the result does not expose a direct interface to the Package. + . + . + Items That are Not Considered Part of a Modified Version + . + (9) Works (including, but not limited to, modules and scripts) that + merely extend or make use of the Package, do not, by themselves, cause + the Package to be a Modified Version. In addition, such works are not + considered parts of the Package itself, and are not subject to the + terms of this license. + . + . + General Provisions + . + (10) Any use, modification, and distribution of the Standard or + Modified Versions is governed by this Artistic License. By using, + modifying or distributing the Package, you accept this license. Do not + use, modify, or distribute the Package, if you do not accept this + license. + . + (11) If your Modified Version has been derived from a Modified + Version made by someone other than you, you are nevertheless required + to ensure that your Modified Version complies with the requirements of + this license. + . + (12) This license does not grant you the right to use any trademark, + service mark, tradename, or logo of the Copyright Holder. + . + (13) This license includes the non-exclusive, worldwide, + free-of-charge patent license to make, have made, use, offer to sell, + sell, import and otherwise transfer the Package with respect to any + patent claims licensable by the Copyright Holder that are necessarily + infringed by the Package. If you institute patent litigation + (including a cross-claim or counterclaim) against any party alleging + that the Package constitutes direct or contributory patent + infringement, then this Artistic License to you shall terminate on the + date that such litigation is filed. + . + (14) Disclaimer of Warranty: + THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS + IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR + NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL + LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL + BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL + DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff -Nru libbusiness-isbn-perl-2.010/debian/libbusiness-isbn-perl.examples libbusiness-isbn-perl-3.004/debian/libbusiness-isbn-perl.examples --- libbusiness-isbn-perl-2.010/debian/libbusiness-isbn-perl.examples 1970-01-01 00:00:00.000000000 +0000 +++ libbusiness-isbn-perl-3.004/debian/libbusiness-isbn-perl.examples 2017-10-14 13:45:47.000000000 +0000 @@ -0,0 +1 @@ +examples/* diff -Nru libbusiness-isbn-perl-2.010/debian/NEWS libbusiness-isbn-perl-3.004/debian/NEWS --- libbusiness-isbn-perl-2.010/debian/NEWS 1970-01-01 00:00:00.000000000 +0000 +++ libbusiness-isbn-perl-3.004/debian/NEWS 2017-10-14 13:45:47.000000000 +0000 @@ -0,0 +1,8 @@ +libbusiness-isbn-perl (3.003-1) unstable; urgency=medium + + From upstream Changes (3.001_01): + + * Remove xisbn stuff's due to be turned off. + * Bump the major version for the API change + + -- Nuno Carvalho Thu, 06 Oct 2016 16:27:26 +0100 diff -Nru libbusiness-isbn-perl-2.010/debian/rules libbusiness-isbn-perl-3.004/debian/rules --- libbusiness-isbn-perl-2.010/debian/rules 2015-12-23 17:10:39.000000000 +0000 +++ libbusiness-isbn-perl-3.004/debian/rules 2017-10-14 13:45:47.000000000 +0000 @@ -1,3 +1,11 @@ #!/usr/bin/make -f + +PACKAGE = $(shell dh_listpackages) +TMP = $(CURDIR)/debian/$(PACKAGE) + %: dh $@ + +override_dh_installexamples: + dh_installexamples + sed -i '1s|^#!perl|#!/usr/bin/perl|' $(TMP)/usr/share/doc/$(PACKAGE)/examples/* diff -Nru libbusiness-isbn-perl-2.010/debian/tests/control libbusiness-isbn-perl-3.004/debian/tests/control --- libbusiness-isbn-perl-2.010/debian/tests/control 2015-12-29 01:46:29.000000000 +0000 +++ libbusiness-isbn-perl-3.004/debian/tests/control 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -Test-Command: /usr/share/pkg-perl-autopkgtest/runner build-deps -Depends: @, @builddeps@, pkg-perl-autopkgtest, libmojolicious-perl - -Test-Command: /usr/share/pkg-perl-autopkgtest/runner runtime-deps -Depends: @, pkg-perl-autopkgtest - -Test-Command: /usr/share/pkg-perl-autopkgtest/runner runtime-deps-and-recommends -Depends: @, pkg-perl-autopkgtest -Restrictions: needs-recommends - -Test-Command: /usr/share/pkg-perl-autopkgtest/runner heavy-deps -Depends: @, pkg-perl-autopkgtest, pkg-perl-autopkgtest-heavy diff -Nru libbusiness-isbn-perl-2.010/examples/private_group_code.pl libbusiness-isbn-perl-3.004/examples/private_group_code.pl --- libbusiness-isbn-perl-2.010/examples/private_group_code.pl 1970-01-01 00:00:00.000000000 +0000 +++ libbusiness-isbn-perl-3.004/examples/private_group_code.pl 2017-04-24 20:04:32.000000000 +0000 @@ -0,0 +1,83 @@ +#!perl +use v5.22; +use feature qw(refaliasing signatures postderef); +no warnings map { "experimental::$_" } qw(refaliasing signatures postderef); + +################################################################## +# I added the error_text method in this version. You might have +# to pull from GitHub to use the latest sources. +# https://github.com/briandfoy/business-isbn +use Business::ISBN '2.010_01'; + +################################################################## +# https://bugs.launchpad.net/evergreen/+bug/1559281/comments/2 +# +# This UbuntuOne thread has some example data for a publisher using +# unassigned group codes. It does not note what the publisher code +# ranges should be. +my @tests = ( + [ qw(9786316294241 6316294247) ], # https://www.worldcat.org/title/black-mass/oclc/933728185 + [ qw(9786316271976 6316271972) ], # DVD "Bridge of Spies" - https://www.worldcat.org/title/bridge-of-spies/oclc/933729520 + [ qw(9786316364036) ], # DVD "Alvin and the Chipmunks. The road chip" - http://www.btol.com/home_whatshot_details.cfm?sideMenu=Featured%20CDs%20and%20DVDs&home=home_whatshot_details.cfm + [ qw(9786316334886) ], # DVD "Spectre" + [ qw(9786316321183) ], # DVD "Southerner" + [ qw(9786316319401) ], # DVD "Spotlight" + [ qw(9786316291431) ], # DVD "Steve Jobs" + ); + +################################################################## +# This part tries the test cases with the official ISBN data +# These should fail since the publisher is using unassigned group +# codes, which are cleverly created in a way that an invalid +# group code throws off the rest of the parsing. +say "========= Before fake group insertion"; +test_isbns( \@tests ); + +################################################################## +# Now insert the fake group code by playing with the internal data +# structure that you aren't supposed to know about. But, if you want +# to use "bad" data, that's the trade-off +say "========= After fake group insertion"; + +# the group code is a key in this hash. The first element of the +# array ref is the label for the group code. The second argument is +# another array ref that are the publisher code ranges. To see more, +# look as Business::ISBN::Data's guts. The publisher ranges must be +# strings so items such as "00" are correctly handled as something of +# length 2. +# +# I don't know what Baker and Taylor are claiming to be the publishers. +$Business::ISBN::country_data{ '631' } = [ + 'Baker and Taylor', + [ '0' => '9' ], + ]; +test_isbns( \@tests ); + +################################################################## +# This sub goes through the array of arrays and makes an ISBN +# object out of each thing. It's an array of arrays because I +# kept together the ISBN-10 and ISBN-13 versions. +# +# I use three experimental Perl features here (if I'm going to spend +# the time writing the example for you, I get to choose!), but it's +# not much work to not use them. You get the idea of what this is +# doing. +sub test_isbns ( $tests ) { + foreach \my @test ( $tests->@* ) { + foreach my $test_isbn ( @test ) { + my $isbn = Business::ISBN->new( $test_isbn ); + if( $isbn->is_valid ) { + say "$test_isbn is valid"; + say "\tgroup -> ", $isbn->group_code; + say "\tpublisher -> ", $isbn->publisher_code; + say "\tarticle -> ", $isbn->article_code; + say "\tchecksum -> ", $isbn->checksum; + } + else { + printf qq(%s is not valid! Error is "%s"\n), + $test_isbn, $isbn->error_text; + } + } + } + } + diff -Nru libbusiness-isbn-perl-2.010/lib/Business/ISBN10.pm libbusiness-isbn-perl-3.004/lib/Business/ISBN10.pm --- libbusiness-isbn-perl-2.010/lib/Business/ISBN10.pm 2015-12-15 07:37:24.000000000 +0000 +++ libbusiness-isbn-perl-3.004/lib/Business/ISBN10.pm 2017-04-24 20:04:32.000000000 +0000 @@ -4,15 +4,6 @@ use Business::ISBN qw(:all); -use subs qw( - _checksum - INVALID_GROUP_CODE - INVALID_PUBLISHER_CODE - BAD_CHECKSUM - GOOD_ISBN - BAD_ISBN - ); - use vars qw( $VERSION $debug @@ -24,7 +15,7 @@ my $debug = 0; -$VERSION = '2.010'; +$VERSION = '3.004'; sub _max_length { 10 } @@ -115,8 +106,9 @@ =head1 COPYRIGHT AND LICENSE -Copyright © 2001-2015, brian d foy . All rights reserved. +Copyright © 2001-2017, brian d foy . All rights reserved. -You may redistribute this under the same terms as Perl itself. +This module is licensed under the Artistic License 2.0. See the LICENSE +file in the distribution, or https://opensource.org/licenses/Artistic-2.0 =cut diff -Nru libbusiness-isbn-perl-2.010/lib/Business/ISBN13.pm libbusiness-isbn-perl-3.004/lib/Business/ISBN13.pm --- libbusiness-isbn-perl-2.010/lib/Business/ISBN13.pm 2015-12-15 07:37:24.000000000 +0000 +++ libbusiness-isbn-perl-3.004/lib/Business/ISBN13.pm 2017-04-24 20:04:32.000000000 +0000 @@ -5,14 +5,6 @@ use Business::ISBN qw(:all); use Data::Dumper; -use subs qw( - _checksum - INVALID_COUNTRY_CODE - INVALID_PUBLISHER_CODE - BAD_CHECKSUM - GOOD_ISBN - BAD_ISBN - ); use vars qw( $VERSION $debug @@ -22,7 +14,7 @@ my $debug = 0; -$VERSION = '2.010'; +$VERSION = '3.004'; sub _max_length { 13 } @@ -79,7 +71,6 @@ return unless defined $data; - my @digits = split //, $data; my $sum = 0; foreach my $index ( 0, 2, 4, 6, 8, 10 ) @@ -126,8 +117,9 @@ =head1 COPYRIGHT AND LICENSE -Copyright © 2001-2015, brian d foy . All rights reserved. +Copyright © 2001-2017, brian d foy . All rights reserved. -You may redistribute this under the same terms as Perl itself. +This module is licensed under the Artistic License 2.0. See the LICENSE +file in the distribution, or https://opensource.org/licenses/Artistic-2.0 =cut diff -Nru libbusiness-isbn-perl-2.010/lib/Business/ISBN.pm libbusiness-isbn-perl-3.004/lib/Business/ISBN.pm --- libbusiness-isbn-perl-2.010/lib/Business/ISBN.pm 2015-12-15 07:37:24.000000000 +0000 +++ libbusiness-isbn-perl-3.004/lib/Business/ISBN.pm 2017-04-24 20:04:32.000000000 +0000 @@ -110,7 +110,7 @@ ); }; -$VERSION = "2.010"; +$VERSION = '3.004'; sub ARTICLE_CODE_OUT_OF_RANGE () { -5 } sub INVALID_PREFIX () { -4 }; @@ -183,10 +183,11 @@ The constructor attempts to determine the group code and the publisher code. If these data cannot be determined, the constructor sets C<< $obj->error >> to something other than C. An object is -still returned and it is up to the program to check C<< $obj->error >> -for one of five values (which may be exported on demand). The actual +still returned and it is up to the program to check the C<< error >> method +for one of five values or one of the C<< error_* >> methods to check for +a particular error. The actual values of these symbolic versions are the same as those from previous -versions of this module which used literal values. +versions of this module which used literal values: Business::ISBN::INVALID_PUBLISHER_CODE @@ -197,10 +198,13 @@ If you have one of these values and want to turn it into a string, you can use the C<%Business::ISBN::ERROR_TEXT> hash, which is exportable -by asking for it explicitly in the import list. +by asking for it explicitly in the import list: use Business::ISBN qw(%ERROR_TEXT); +As of version 2.010_01, you can get this text from C<< error_text >> +so you don't have to import anything. + The string passed as the ISBN need not be a valid ISBN as long as it superficially looks like one. This allows one to use the C method. Despite the disclaimer in the discussion of @@ -294,7 +298,43 @@ =cut -sub error { $_[0]->{'valid'} } +sub error { $_[0]->{'valid'} < 1 and $_[0]->{'valid'} } + +=item error_is_bad_group + +=item error_is_bad_publisher + +=item error_is_article_out_of_range + +=item error_is_bad_checksum + +Returns true if the ISBN error is that type. + +=cut + +sub error_is_bad_group { + return $_[0]->error == INVALID_GROUP_CODE; + } + +sub error_is_bad_publisher { + return $_[0]->error == INVALID_PUBLISHER_CODE; + } + +sub error_is_article_out_of_range { + return $_[0]->error == ARTICLE_CODE_OUT_OF_RANGE; + } + +sub error_is_bad_checksum { + return $_[0]->error == BAD_CHECKSUM; + } + +=item error_text + +Returns a text version of the error text + +=cut + +sub error_text { $ERROR_TEXT{$_[0]->{'valid'}} } =item is_valid @@ -524,63 +564,6 @@ croak "as_isbn13() must be implemented in Business::ISBN subclass" } -=item xisbn - -In scalar context, returns an anonymous array of related ISBNs using xISBN. -In list context, returns a list. It does not include the original ISBN. - -This feature requires C or C. - -=cut - -sub xisbn { - my $self = shift; - - my $data = $self->_get_xisbn; - $data =~ tr/x/X/; - - my @isbns = do { - if( eval "require Mojo::DOM; 1" ) { - my $dom = Mojo::DOM->new( $data ); - $dom->find( 'isbn' )->map('text')->each; - } - else { - $data =~ m|(.*?)|g; - } - }; - - shift @isbns; - wantarray ? @isbns : \@isbns; - } - -sub _get_xisbn { - my $self = shift; - - my $data = eval { - if( eval "require Mojo::UserAgent; 1" ) { - Mojo::UserAgent->new->get( $self->_xisbn_url )->res->text; - } - elsif( eval "require LWP::Simple; 1" ) { - LWP::Simple::get( $self->_xisbn_url ); - } - else { - carp "Could not load either Mojo::UserAgent or LWP::Simple to fetch xISBN\n"; - return; - } - }; - - carp "Could not fetch xISBN data" unless defined $data; - - return $data; - } - -sub _xisbn_url { - my $self = shift; - my $isbn = $self->as_string([]); - - return "http://xisbn.worldcat.org/xid/isbn/$isbn"; - } - =item increment Returns the next C by incrementing the article code of @@ -902,9 +885,10 @@ =head1 COPYRIGHT AND LICENSE -Copyright © 2001-2015, brian d foy . All rights reserved. +Copyright © 2001-2017, brian d foy . All rights reserved. -You may redistribute this under the same terms as Perl itself. +This module is licensed under the Artistic License 2.0. See the LICENSE +file in the distribution, or https://opensource.org/licenses/Artistic-2.0 =head1 CREDITS diff -Nru libbusiness-isbn-perl-2.010/Makefile.PL libbusiness-isbn-perl-3.004/Makefile.PL --- libbusiness-isbn-perl-2.010/Makefile.PL 2015-12-15 07:37:24.000000000 +0000 +++ libbusiness-isbn-perl-3.004/Makefile.PL 2017-04-24 20:04:32.000000000 +0000 @@ -49,7 +49,7 @@ 'NAME' => $module, 'ABSTRACT_FROM' => $main_file, 'VERSION_FROM' => $main_file, - 'LICENSE' => 'perl', + 'LICENSE' => 'artistic_2', 'AUTHOR' => 'brian d foy ', 'CONFIGURE_REQUIRES' => { @@ -66,9 +66,6 @@ 'PREREQ_PM' => { 'Business::ISBN::Data' => '20140910.002', - 'Mojo::DOM' => '0', - 'Mojo::UserAgent' => '0', - 'URI' => '0', }, 'META_MERGE' => { diff -Nru libbusiness-isbn-perl-2.010/MANIFEST libbusiness-isbn-perl-3.004/MANIFEST --- libbusiness-isbn-perl-2.010/MANIFEST 2015-12-15 07:37:27.000000000 +0000 +++ libbusiness-isbn-perl-3.004/MANIFEST 2017-04-24 20:04:35.000000000 +0000 @@ -1,6 +1,7 @@ bad-isbn13s.txt bad-isbns.txt Changes +examples/private_group_code.pl examples/README INSTALL.SKIP isbn13s.txt @@ -16,6 +17,7 @@ scripts/get_isbn_data.pl t/albania.t t/constants.t +t/errors.t t/github/3.t t/interface.t t/isbn10.t @@ -31,7 +33,6 @@ t/step.t t/test_manifest t/valid_isbn_checksum.t -t/xisbn10.t xt/changes.t META.yml Module YAML meta-data (added by MakeMaker) META.json Module JSON meta-data (added by MakeMaker) diff -Nru libbusiness-isbn-perl-2.010/MANIFEST.SKIP libbusiness-isbn-perl-3.004/MANIFEST.SKIP --- libbusiness-isbn-perl-2.010/MANIFEST.SKIP 2015-12-15 07:37:24.000000000 +0000 +++ libbusiness-isbn-perl-3.004/MANIFEST.SKIP 2017-04-24 20:04:32.000000000 +0000 @@ -59,6 +59,7 @@ \.travis\.yml +\.appveyor.yml \.releaserc \.lwpcookies Business-.* diff -Nru libbusiness-isbn-perl-2.010/META.json libbusiness-isbn-perl-3.004/META.json --- libbusiness-isbn-perl-2.010/META.json 2015-12-15 07:37:27.000000000 +0000 +++ libbusiness-isbn-perl-3.004/META.json 2017-04-24 20:04:35.000000000 +0000 @@ -6,7 +6,7 @@ "dynamic_config" : 1, "generated_by" : "ExtUtils::MakeMaker version 7.04, CPAN::Meta::Converter version 2.140640", "license" : [ - "perl_5" + "artistic_2" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", @@ -32,9 +32,6 @@ "runtime" : { "requires" : { "Business::ISBN::Data" : "20140910.002", - "Mojo::DOM" : "0", - "Mojo::UserAgent" : "0", - "URI" : "0", "perl" : "5.008" } }, @@ -56,5 +53,5 @@ "web" : "https://github.com/briandfoy/business-isbn" } }, - "version" : "2.010" + "version" : "3.004" } diff -Nru libbusiness-isbn-perl-2.010/META.yml libbusiness-isbn-perl-3.004/META.yml --- libbusiness-isbn-perl-2.010/META.yml 2015-12-15 07:37:26.000000000 +0000 +++ libbusiness-isbn-perl-3.004/META.yml 2017-04-24 20:04:34.000000000 +0000 @@ -9,7 +9,7 @@ File::Spec::Functions: '0' dynamic_config: 1 generated_by: 'ExtUtils::MakeMaker version 7.04, CPAN::Meta::Converter version 2.140640' -license: perl +license: artistic_2 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' @@ -20,12 +20,9 @@ - inc requires: Business::ISBN::Data: '20140910.002' - Mojo::DOM: '0' - Mojo::UserAgent: '0' - URI: '0' perl: '5.008' resources: bugtracker: https://github.com/briandfoy/business-isbn/issues homepage: https://github.com/briandfoy/business-isbn repository: https://github.com/briandfoy/business-isbn.git -version: '2.010' +version: '3.004' diff -Nru libbusiness-isbn-perl-2.010/README.pod libbusiness-isbn-perl-3.004/README.pod --- libbusiness-isbn-perl-2.010/README.pod 2015-12-15 07:37:24.000000000 +0000 +++ libbusiness-isbn-perl-3.004/README.pod 2017-04-24 20:04:32.000000000 +0000 @@ -2,6 +2,14 @@ =encoding utf8 +=for HTML + +=for HTML Coverage Status + +=for HTML + +=for HTML + =head1 The Business::ISBN module This is the I for the L Perl module, which diff -Nru libbusiness-isbn-perl-2.010/t/errors.t libbusiness-isbn-perl-3.004/t/errors.t --- libbusiness-isbn-perl-2.010/t/errors.t 1970-01-01 00:00:00.000000000 +0000 +++ libbusiness-isbn-perl-3.004/t/errors.t 2017-04-24 20:04:32.000000000 +0000 @@ -0,0 +1,45 @@ +use Test::More; + +my $class = 'Business::ISBN'; + +use_ok( $class ) or BAIL_OUT( "$class did not compile" ); +can_ok( $class, qw( error_text error ) ); + +subtest bad_group => sub { + can_ok( $class, qw(error_is_bad_group error_text error) ); + # blake and taylor fake ISBNs for their DVDs + my @bad_isbns = qw(9786316294241 6316294247); + + foreach my $try ( @bad_isbns ) { + my $isbn = $class->new( $try ); + ok( ! $isbn->is_valid, "ISBN $try is invalid" ); + ok( $isbn->error, "ISBN $try is an error" ); + like( $isbn->error_text, qr/group/, "ISBN $try error text mentions 'group'" ); + ok( $isbn->error_is_bad_group, "ISBN $try has a bad group" ); + } + + my @good_isbns = qw(0596527241); + + foreach my $try ( @good_isbns ) { + my $isbn = $class->new( $try ); + ok( $isbn->is_valid, "ISBN $try is valid" ); + ok( ! $isbn->error, "ISBN $try is not an error" ); + } + }; + +subtest bad_publisher => sub { + can_ok( $class, qw(error_is_bad_publisher) ); + + my @bad_isbns = qw(9656123456); + + foreach my $try ( @bad_isbns ) { + my $isbn = $class->new( $try ); + ok( ! $isbn->is_valid, "ISBN $try is invalid" ); + ok( $isbn->error, "ISBN $try is an error" ); + like( $isbn->error_text, qr/publisher/, "ISBN $try error text mentions 'publisher'" ); + ok( $isbn->error_is_bad_publisher, "ISBN $try has a bad publisher" ); + } + }; + + +done_testing(); diff -Nru libbusiness-isbn-perl-2.010/t/test_manifest libbusiness-isbn-perl-3.004/t/test_manifest --- libbusiness-isbn-perl-2.010/t/test_manifest 2015-12-15 07:37:24.000000000 +0000 +++ libbusiness-isbn-perl-3.004/t/test_manifest 2017-04-24 20:04:32.000000000 +0000 @@ -7,7 +7,7 @@ isbn10.t isbn13.t valid_isbn_checksum.t -xisbn10.t +errors.t png_barcode.t step.t rt/27107.t diff -Nru libbusiness-isbn-perl-2.010/t/xisbn10.t libbusiness-isbn-perl-3.004/t/xisbn10.t --- libbusiness-isbn-perl-2.010/t/xisbn10.t 2015-12-15 07:37:24.000000000 +0000 +++ libbusiness-isbn-perl-3.004/t/xisbn10.t 1970-01-01 00:00:00.000000000 +0000 @@ -1,67 +0,0 @@ -use Test::More; - -BEGIN { - require IO::Socket; - - my $host = 'labs.oclc.org'; - - my $socket = IO::Socket::INET->new( - PeerAddr => "$host:80", - Timeout => 5, - ); - - unless( $socket ) - { - print STDERR <<"HERE"; - --------------------------------------------------------- -I cannot run these tests unless I can connect to $host. -You may not be connected to the network or the host may -be down. --------------------------------------------------------- -HERE - - plan skip_all => "Could not reach $host: skipping tests"; - } - } - - - - -my $hash = { - '1565922573' => [qw(0585054061)], - '0684833395' => [qw(0671502336 044011120X 0679437223 0440204399 0886461251 0684865130 067189854X 070898164X 1560549602 0736690859 0736689621 0671202960 0224613286 0886464935 5237000665 9660301588 1560549238 8401410266 9576773075 0552015008 2246269318 8388087398 5718100012 8306023056 4653014507 5770770910 8385855807 7805676291 8939202376 8939202384 8939202392 9633070597 9735761599 3596125723 5273001285 7531213451 8387974811 8474444896 8501009261 8700199583 8700964344 8845228827 9146133690 9512045583 9635483325)], - }; - -my @isbns = sort keys %$hash; - -plan tests => 6 * @isbns + 1; - -use_ok( "Business::ISBN" ); - -foreach my $string ( @isbns ) - { - local $^W=0; - my $isbn = Business::ISBN->new( $string ); - isa_ok( $isbn, 'Business::ISBN10' ); - ok( $isbn->is_valid, "$isbn is valid" ); - - is( $isbn->_xisbn_url, - "http://xisbn.worldcat.org/xid/isbn/$string", - "URL is correct for $string" ); - - my $expected = $hash->{$isbn}; - - #scalar context - my $isbns = $isbn->xisbn; - isa_ok( $isbns, 'ARRAY' ); - my $count = grep { /$string/ } @$isbns; - is( $count, 0, "List does not contain $string" ); - eq_array( $isbns, $expected, "List is correct" ); - - #list context - my @isbns = $isbn->xisbn; - $count = grep { /$string/ } @isbns; - is( $count, 0, "List does not contain $string" ); - eq_array( \@isbns, $expected, "List is correct" ); - }