Hello community,
here is the log from the commit of package perl-Business-ISMN for
openSUSE:Factory checked in at 2015-04-25 21:15:15
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Business-ISMN (Old)
and /work/SRC/openSUSE:Factory/.perl-Business-ISMN.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Business-ISMN"
Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-Business-ISMN/perl-Business-ISMN.changes
2013-07-01 15:59:13.000000000 +0200
+++
/work/SRC/openSUSE:Factory/.perl-Business-ISMN.new/perl-Business-ISMN.changes
2015-04-25 21:15:16.000000000 +0200
@@ -1,0 +2,6 @@
+Tue Apr 14 12:36:46 UTC 2015 - [email protected]
+
+- updated to 1.13
+ see /usr/share/doc/packages/perl-Business-ISMN/Changes
+
+-------------------------------------------------------------------
Old:
----
Business-ISMN-1.11.tar.gz
New:
----
Business-ISMN-1.13.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-Business-ISMN.spec ++++++
--- /var/tmp/diff_new_pack.MKSlkO/_old 2015-04-25 21:15:16.000000000 +0200
+++ /var/tmp/diff_new_pack.MKSlkO/_new 2015-04-25 21:15:16.000000000 +0200
@@ -1,7 +1,7 @@
#
# spec file for package perl-Business-ISMN
#
-# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
Name: perl-Business-ISMN
-Version: 1.11
+Version: 1.13
Release: 0
%define cpan_name Business-ISMN
Summary: work with International Standard Music Numbers
@@ -29,10 +29,8 @@
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: perl
BuildRequires: perl-macros
-BuildRequires: perl(Tie::Cycle)
-#BuildRequires: perl(Business::ISMN)
-#BuildRequires: perl(Business::ISMN::Data)
-Requires: perl(Tie::Cycle)
+BuildRequires: perl(Tie::Cycle) >= 1.21
+Requires: perl(Tie::Cycle) >= 1.21
%{perl_requires}
%description
++++++ Business-ISMN-1.11.tar.gz -> Business-ISMN-1.13.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Business-ISMN-1.11/Changes
new/Business-ISMN-1.13/Changes
--- old/Business-ISMN-1.11/Changes 2007-10-26 05:02:14.000000000 +0200
+++ new/Business-ISMN-1.13/Changes 2014-11-28 06:43:36.000000000 +0100
@@ -1,4 +1,12 @@
-# $Id: Changes,v 1.14 2007/10/26 03:02:14 comdog Exp $
+# Changes for Business::ISMN
+
+1.13 - Fri Nov 28 00:42:54 2014
+ * Reqire a recent Tie::Cycle. Some CPAN testers picked up a ghost
+ version somehow.
+
+1.12 - Fri Nov 21 23:06:24 2014
+ * RT #100506 : Fix package name
+ * Modernize distro
1.11 - Thu Oct 25 22:01:29 2007
* distro adjustments. no big whoop.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Business-ISMN-1.11/MANIFEST
new/Business-ISMN-1.13/MANIFEST
--- old/Business-ISMN-1.11/MANIFEST 2007-01-10 06:38:05.000000000 +0100
+++ new/Business-ISMN-1.13/MANIFEST 2014-11-28 06:43:38.000000000 +0100
@@ -1,11 +1,12 @@
Changes
examples/README
ismns.txt
-lib/Data.pm
-lib/ISMN.pm
+lib/Business/ISMN.pm
+lib/Business/ISMN/Data.pm
LICENSE
Makefile.PL
MANIFEST This list of files
+MANIFEST.SKIP
META.yml
README
t/ismn.t
@@ -14,3 +15,4 @@
t/pod_coverage.t
t/prereq.t
t/test_manifest
+META.json Module JSON meta-data (added by
MakeMaker)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Business-ISMN-1.11/MANIFEST.SKIP
new/Business-ISMN-1.13/MANIFEST.SKIP
--- old/Business-ISMN-1.11/MANIFEST.SKIP 1970-01-01 01:00:00.000000000
+0100
+++ new/Business-ISMN-1.13/MANIFEST.SKIP 2014-11-28 06:43:36.000000000
+0100
@@ -0,0 +1,65 @@
+
+#!start included /usr/local/perls/perl-5.18.1/lib/5.18.1/ExtUtils/MANIFEST.SKIP
+# Avoid version control files.
+\bRCS\b
+\bCVS\b
+\bSCCS\b
+,v$
+\B\.svn\b
+\B\.git\b
+\B\.gitignore\b
+\b_darcs\b
+\B\.cvsignore$
+
+# Avoid VMS specific MakeMaker generated files
+\bDescrip.MMS$
+\bDESCRIP.MMS$
+\bdescrip.mms$
+
+# Avoid Makemaker generated and utility files.
+\bMANIFEST\.bak
+\bMakefile$
+\bblib/
+\bMakeMaker-\d
+\bpm_to_blib\.ts$
+\bpm_to_blib$
+\bblibdirs\.ts$ # 6.18 through 6.25 generated this
+
+# Avoid Module::Build generated and utility files.
+\bBuild$
+\b_build/
+\bBuild.bat$
+\bBuild.COM$
+\bBUILD.COM$
+\bbuild.com$
+
+# Avoid temp and backup files.
+~$
+\.old$
+\#$
+\b\.#
+\.bak$
+\.tmp$
+\.#
+\.rej$
+
+# Avoid OS-specific files/dirs
+# Mac OSX metadata
+\B\.DS_Store
+# Mac OSX SMB mount metadata files
+\B\._
+
+# Avoid Devel::Cover and Devel::CoverX::Covered files.
+\bcover_db\b
+\bcovered\b
+
+# Avoid MYMETA files
+^MYMETA\.
+#!end included /usr/local/perls/perl-5.18.1/lib/5.18.1/ExtUtils/MANIFEST.SKIP
+
+
+\.travis\.yml
+\.releaserc
+\.lwpcookies
+Business-.*
+hacks/
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Business-ISMN-1.11/META.json
new/Business-ISMN-1.13/META.json
--- old/Business-ISMN-1.11/META.json 1970-01-01 01:00:00.000000000 +0100
+++ new/Business-ISMN-1.13/META.json 2014-11-28 06:43:38.000000000 +0100
@@ -0,0 +1,31 @@
+{
+ "abstract" : "Work with International Standard Music Numbers",
+ "author" : [
+ "brian d foy <[email protected]>"
+ ],
+ "dynamic_config" : 1,
+ "generated_by" : "ExtUtils::MakeMaker version 6.66, CPAN::Meta::Converter
version 2.132830",
+ "license" : [
+ "perl_5"
+ ],
+ "meta-spec" : {
+ "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
+ "version" : "2"
+ },
+ "name" : "Business-ISMN",
+ "no_index" : {
+ "directory" : [
+ "t",
+ "inc"
+ ]
+ },
+ "release_status" : "stable",
+ "resources" : {
+ "repository" : {
+ "type" : "git",
+ "url" : "https://github.com/briandfoy/business--isbn.git",
+ "web" : "https://github.com/briandfoy/business--isbn"
+ }
+ },
+ "version" : "1.13"
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Business-ISMN-1.11/META.yml
new/Business-ISMN-1.13/META.yml
--- old/Business-ISMN-1.11/META.yml 2007-10-26 05:02:21.000000000 +0200
+++ new/Business-ISMN-1.13/META.yml 2014-11-28 06:43:38.000000000 +0100
@@ -1,16 +1,19 @@
---- #YAML:1.0
-name: Business-ISMN
-version: 1.11
-abstract: Work with International Standard Music Numbers
-license: perl
-generated_by: ExtUtils::MakeMaker version 6.36
-distribution_type: module
-requires:
- List::Util: 0
- Test::More: 0
- Tie::Cycle: 0
-meta-spec:
- url: http://module-build.sourceforge.net/META-spec-v1.3.html
- version: 1.3
+---
+abstract: 'Work with International Standard Music Numbers'
author:
- - brian d foy <[email protected]>
+ - 'brian d foy <[email protected]>'
+build_requires: {}
+dynamic_config: 1
+generated_by: 'ExtUtils::MakeMaker version 6.66, CPAN::Meta::Converter version
2.132830'
+license: perl
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.4.html
+ version: 1.4
+name: Business-ISMN
+no_index:
+ directory:
+ - t
+ - inc
+resources:
+ repository: https://github.com/briandfoy/business--isbn.git
+version: 1.13
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Business-ISMN-1.11/Makefile.PL
new/Business-ISMN-1.13/Makefile.PL
--- old/Business-ISMN-1.11/Makefile.PL 2007-10-26 04:53:51.000000000 +0200
+++ new/Business-ISMN-1.13/Makefile.PL 2014-11-28 06:43:36.000000000 +0100
@@ -1,26 +1,34 @@
-# $Id: Makefile.PL,v 1.8 2007/10/26 02:53:51 comdog Exp $
-use ExtUtils::MakeMaker;
+require 5.008;
-eval "use Test::Manifest 1.14";
+use ExtUtils::MakeMaker 6.65;
+
+eval "use Test::Manifest 1.21";
WriteMakefile(
'NAME' => 'Business::ISMN',
- 'VERSION_FROM' => 'lib/ISMN.pm',
+ 'VERSION_FROM' => 'lib/Business/ISMN.pm',
'LICENSE' => 'perl',
'AUTHOR' => 'brian d foy <[email protected]>',
'ABSTRACT' => 'Work with International Standard Music Numbers',
'PREREQ_PM' => {
'List::Util' => '0',
- 'Test::More' => '0',
- 'Tie::Cycle' => '0',
+ 'Tie::Cycle' => '1.21',
},
- 'PM' => { 'lib/ISMN.pm' => '$(INST_LIBDIR)/ISMN.pm',
- 'lib/Data.pm' => '$(INST_LIBDIR)/ISMN/Data.pm',
-
- },
- 'MAN3PODS' => {
- 'lib/ISMN.pm' => '$(INST_MAN3DIR)/Business::ISMN.3',
+
+ 'TEST_REQUIRES' => {
+ 'Test::More' => '0.95',
+ },
+
+ 'META_MERGE' => {
+ 'meta-spec' => { version => 2 },
+ resources => {
+ repository => {
+ type => 'git',
+ url =>
'https://github.com/briandfoy/business--isbn.git',
+ web =>
'https://github.com/briandfoy/business--isbn',
+ },
+ },
},
clean => { FILES => 'Business-ISMN-*' },
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Business-ISMN-1.11/lib/Business/ISMN/Data.pm
new/Business-ISMN-1.13/lib/Business/ISMN/Data.pm
--- old/Business-ISMN-1.11/lib/Business/ISMN/Data.pm 1970-01-01
01:00:00.000000000 +0100
+++ new/Business-ISMN-1.13/lib/Business/ISMN/Data.pm 2014-11-28
06:43:36.000000000 +0100
@@ -0,0 +1,75 @@
+package Business::ISMN::Data;
+use strict;
+
+our $VERSION = '1.13';
+
+=head1 NAME
+
+Business::ISMN::Data - data pack for Business::ISMN
+
+=head1 SYNOPSIS
+
+see Business::ISMN
+
+=head1 DESCRIPTION
+
+See L<Business::ISMN>.
+
+=head1 AUTHOR
+
+brian d foy, C<< <[email protected]> >>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (c) 2005-2014 brian d foy. All rights reserved.
+
+This program is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
+package Business::ISMN;
+use strict;
+
+use vars qw( %publisher_data @publisher_tuples );
+
+%publisher_data = (
+'AU' => [ ['075', undef], [2700, 2701], [67300, 67310], [720000, 720200],
[9009500, 9009799] ],
+'CA' => [ [53001, 53010], [706001, 706050], [9001301, 9001600] ],
+'CY' => [ [720300, 720320], [9009800, 9009850] ],
+'CZ' => [ [2600, 2605], [66050, 66100], [706500, 706600], [9004000, 9005000] ],
+'DE' => [ ['000', '025'], [2000, 2150], [50000, 52000], [700000, 705000],
[9000000, 9001000] ],
+'DK' => [ [66130, 66140], [706750, 706800], [9001801, 9001900] ],
+'ES' => [ [3500, 3507], [69200, 69224], [801200, 801219], [9013100, 9013119] ],
+'FI' => [ ['042', undef], [55001, 55020], [706300, 706349], [9001601, 9001700]
],
+'FR' => [ ['043', '048'], [2301, 2400], [56000, 56500] ],
+'GB' => [ ['050', '060'], [2201, 2300], [57000, 57999], [708001, 709000],
[9002000, 9002999] ],
+'GH' => [ [9008000, 9008100] ],
+'GR' => [ [69150, 69159], [801150, 801179], [9013030, 9013079] ],
+'HR' => [ [706700, 706710], [9005201, 9005250] ],
+'HU' => [ [55030, undef], [706251, 706260], [9005251, 9005260], ['080', undef]
],
+'IT' => [ ['039', '041'], [2151, 2200], [52001, 53000], [705001, 706000],
[9001001, 9001300] ],
+'JP' => [ [65001, undef] ],
+'LK' => [ [710000, 710100], [9006400, 9006500] ],
+'LT' => [ [59995, 59999], [706201, 706250] ],
+'LV' => [ [706650, 706660], [9005001, 9005100] ],
+'NO' => [ ['065', undef], [2610, 2617], [66101, 66115], [706680, 706690],
[9005101, 9005200] ],
+'PT' => [ [3000, undef], [707700, 707750], [9007500, 9007600] ],
+'RU' => [ [66000, 66055] ],
+'SE' => [ ['070', undef], [66150, 66170], [706850, 706900], [9006000, 9006200]
],
+'SI' => [ [709001, 709100], [9009000, 9009100] ],
+'SK' => [ [68500, 68520], [9010001, 9010050] ],
+'TR' => [ ['036', '037'], [3440, 3445], [69080, 69095], [801100, 801120],
[9013000, 9013010] ],
+'UA' => [ [707500, 707600], [9007000, 9007200] ],
+'US' => [ ['081', '099'], [3005, 3205], [58000, 58199], [60001, 60002],
[800000, 800199], [9012000, 9012099] ],
+);
+
+foreach my $key ( keys %publisher_data )
+ {
+ my @pairs = map { [ $key, @$_ ] } @{ $publisher_data{$key} };
+ push @publisher_tuples, @pairs;
+ }
+
+@publisher_tuples = sort { $a->[1] <=> $b->[1] } @publisher_tuples;
+
+1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Business-ISMN-1.11/lib/Business/ISMN.pm
new/Business-ISMN-1.13/lib/Business/ISMN.pm
--- old/Business-ISMN-1.11/lib/Business/ISMN.pm 1970-01-01 01:00:00.000000000
+0100
+++ new/Business-ISMN-1.13/lib/Business/ISMN.pm 2014-11-28 06:43:36.000000000
+0100
@@ -0,0 +1,559 @@
+package Business::ISMN;
+use strict;
+
+use base qw(Exporter);
+use subs qw(
+ _common_format _checksum is_valid_checksum
+ INVALID_PUBLISHER_CODE
+ BAD_CHECKSUM
+ GOOD_ISMN
+ BAD_ISMN
+ );
+use vars qw( $VERSION @ISA @EXPORT_OK $debug %country_data
+ $MAX_COUNTRY_CODE_LENGTH );
+
+use Carp qw(carp);
+use Exporter;
+use List::Util qw(sum);
+use Tie::Cycle;
+use Business::ISMN::Data;
+
+my $debug = 0;
+
+@EXPORT_OK = qw(is_valid_checksum ean_to_ismn ismn_to_ean
+ INVALID_PUBLISHER_CODE BAD_CHECKSUM GOOD_ISMN BAD_ISMN);
+
+($VERSION) = '1.13';
+
+sub INVALID_PUBLISHER_CODE { -3 };
+sub BAD_CHECKSUM { -1 };
+sub GOOD_ISMN { 1 };
+sub BAD_ISMN { 0 };
+
+my %Lengths = qw(
+ 0 3
+ 1 4
+ 2 4
+ 3 4
+ 4 5
+ 5 5
+ 6 5
+ 7 6
+ 8 6
+ 9 7
+ );
+
+sub new
+ {
+ my $class = shift;
+ my $common_data = _common_format shift;
+
+ return unless defined $common_data;
+
+ my $self = {};
+ bless $self, $class;
+
+ $self->{'ismn'} = $common_data;
+ $self->{'positions'} = [1,undef,9];
+
+ # we don't know if we have a valid publisher code,
+ # so let's assume we don't
+ $self->{'valid'} = INVALID_PUBLISHER_CODE;
+
+ # let's check the publisher code.
+ my $code_length = $Lengths{ substr( $self->{'ismn'}, 1, 1 ) };
+ $self->{publisher_code} = substr(
+ $self->{'ismn'},
+ 1,
+ $code_length
+ );
+
+ my $code_end = $code_length + 1;
+
+ $self->{'positions'}[1] = $code_end;
+
+ return $self unless $self->is_valid_publisher_code;
+
+ # we have a good publisher code, so
+ # assume we have a bad checksum until we check
+ $self->{'valid'} = BAD_CHECKSUM;
+
+ $self->{'article_code'} = substr( $self->{'ismn'}, $code_end, 9 -
$code_end );
+ $self->{'checksum'} = substr( $self->{'ismn'}, -1, 1 );
+
+ $self->{'valid'} = is_valid_checksum( $self->{'ismn'} );
+
+ return $self;
+ }
+
+
+#it's your fault if you muck with the internals yourself
+# none of these take arguments
+sub ismn () { my $self = shift; return $self->{'ismn'} }
+sub is_valid () { my $self = shift; return $self->{'valid'} }
+sub publisher () { my $self = shift; return $self->{'publisher'} }
+sub publisher_code () { my $self = shift; return $self->{'publisher_code'} }
+sub article_code () { my $self = shift; return $self->{'article_code'} }
+sub checksum () { my $self = shift; return $self->{'checksum'} }
+sub hyphen_positions () { my $self = shift; return @{$self->{'positions'}} }
+
+
+sub fix_checksum
+ {
+ my $self = shift;
+
+ my $last_char = substr($self->{'ismn'}, 9, 1);
+ my $checksum = _checksum $self->ismn;
+
+ substr($self->{'ismn'}, 9, 1) = $checksum;
+
+ $self->_check_validity;
+
+ return 0 if $last_char eq $checksum;
+ return 1;
+ }
+
+sub as_string
+ {
+ my $self = shift;
+ my $array_ref = shift;
+
+ #this allows one to override the positions settings from the
+ #constructor
+ $array_ref = $self->{'positions'} unless ref $array_ref eq 'ARRAY';
+
+ return unless $self->is_valid eq GOOD_ISMN;
+ my $ismn = $self->ismn;
+
+ foreach my $position ( sort { $b <=> $a } @$array_ref )
+ {
+ next if $position > 9 or $position < 1;
+ substr($ismn, $position, 0) = '-';
+ }
+
+ return $ismn;
+ }
+
+sub as_ean
+ {
+ my $self = shift;
+
+ my $ismn = ref $self ? $self->as_string([]) : _common_format $self;
+
+ return unless ( defined $ismn and length $ismn == 10 );
+
+ # the M becomes a zero in bookland
+ substr( $ismn, 0, 1 ) = '0';
+
+ my $ean = '979' . substr($ismn, 0, 9);
+
+ my $sum = 0;
+ foreach my $index ( 0, 2, 4, 6, 8, 10 )
+ {
+ $sum += substr($ean, $index, 1);
+ $sum += 3 * substr($ean, $index + 1, 1);
+ }
+
+ #take the next higher multiple of 10 and subtract the sum.
+ #if $sum is 37, the next highest multiple of ten is 40. the
+ #check digit would be 40 - 37 => 3.
+ $ean .= ( 10 * ( int( $sum / 10 ) + 1 ) - $sum ) % 10;
+
+ return $ean;
+ }
+
+sub is_valid_publisher_code
+ {
+ my $self = shift;
+ my $code = $self->publisher_code;
+
+ my $success = 0;
+
+ foreach my $tuple ( @publisher_tuples )
+ {
+ no warnings;
+ next if( defined $tuple->[2] and $code > $tuple->[2] );
+ last if $code < $tuple->[1];
+ if( $code >= $tuple->[1] and $code <= $tuple->[2] )
+ {
+ $success = 1;
+ $self->{'publisher'} = $tuple->[0];
+ last;
+ }
+ }
+
+ return $success;
+ }
+
+sub is_valid_checksum
+ {
+ my $data = _common_format shift;
+
+ return BAD_ISMN unless defined $data;
+
+ return GOOD_ISMN if substr($data, 9, 1) eq _checksum $data;
+
+ return BAD_CHECKSUM;
+ }
+
+sub ean_to_ismn
+ {
+ my $ean = shift;
+
+ $ean =~ s/[^0-9]//g;
+
+ return unless length $ean == 13;
+ return unless substr($ean, 0, 3) eq 979;
+
+ #XXX: fix to change leading 0 back to M
+ my $ismn = Business::ISMN->new( substr($ean, 3, 9) . '1' );
+
+ $ismn->fix_checksum;
+
+ return $ismn->as_string([]) if $ismn->is_valid;
+
+ return;
+ }
+
+
+sub ismn_to_ean
+ {
+ my $ismn = _common_format shift;
+
+ return unless (defined $ismn and is_valid_checksum($ismn) eq GOOD_ISMN);
+
+ return as_ean($ismn);
+ }
+
+sub png_barcode
+ {
+ my $self = shift;
+
+ my $ean = ismn_to_ean( $self->as_string([]) );
+
+ eval "use GD::Barcode::EAN13";
+ if( $@ )
+ {
+ carp "GD::Barcode::EAN13 required to make PNG barcodes";
+ return;
+ }
+
+ my $image = GD::Barcode::EAN13->new($ean)->plot->png;
+
+ return $image;
+ }
+
+#internal function. you don't get to use this one.
+sub _check_validity
+ {
+ my $self = shift;
+
+ if( is_valid_checksum $self->{'ismn'} eq GOOD_ISMN
+ and defined $self->{'publisher_code'} )
+ {
+ $self->{'valid'} = GOOD_ISMN;
+ }
+ else
+ {
+ $self->{'valid'} = INVALID_PUBLISHER_CODE
+ unless defined $self->{'publisher_code'};
+ $self->{'valid'} = GOOD_ISMN
+ unless is_valid_checksum $self->{'ismn'} ne GOOD_ISMN;
+ }
+ }
+
+#internal function. you don't get to use this one.
+sub _checksum
+ {
+ my $data = _common_format shift;
+
+ tie my $factor, 'Tie::Cycle', [ 1, 3 ];
+ return unless defined $data;
+
+ my $sum = 9;
+
+ foreach my $digit ( split //, substr( $data, 1, 8 ) )
+ {
+ my $mult = $factor;
+ $sum += $digit * $mult;
+ }
+
+
+ #return what the check digit should be
+ # the extra mod 10 turns 10 into 0.
+ my $checksum = ( 10 - ($sum % 10) ) % 10;
+
+ return $checksum;
+ }
+
+#internal function. you don't get to use this one.
+sub _common_format {
+ no warnings qw(uninitialized);
+ #we want uppercase X's
+ my $data = uc shift;
+
+ # get rid of everything except decimal digits and X
+ # and leading M
+ $data =~ s/[^0-9M]//g;
+
+ return $1 if $data =~ m/
+ ^
+ (
+ M
+ \d{9}
+ )
+ $
+ /x;
+
+ return;
+ }
+
+1;
+
+__END__
+
+=head1 NAME
+
+Business::ISMN - work with International Standard Music Numbers
+
+=head1 SYNOPSIS
+
+ use Business::ISMN;
+
+ $ismn_object = new Business::ISMN('M021765430');
+ $ismn_object = new Business::ISMN('M-021-76543-0');
+
+ #print the ISMN with hyphens at positions specified
+ #by constructor
+ print $ismn_object->as_string;
+
+ #print the ISMN with hyphens at specified positions.
+ #this not does affect the default positions
+ print $ismn_object->as_string([]);
+
+ #print the publisher or publisher code
+ print $ismn->publisher;
+ print $ismn->publisher_code;
+
+ #check to see if the ISMN is valid
+ $ismn_object->is_valid;
+
+ #fix the ISMN checksum. BEWARE: the error might not be
+ #in the checksum!
+ $ismn_object->fix_checksum;
+
+ # create an EAN13 barcode in PNG format
+ $ismn_object->png_barcode;
+
+ #EXPORTABLE FUNCTIONS
+
+ use Business::ISMN qw( is_valid_checksum
+ ismn_to_ean ean_to_ismn );
+
+ #verify the checksum
+ if( is_valid_checksum('0123456789')
+ eq Business::ISMN::GOOD_ISMN )
+ { ... }
+
+ #convert to EAN (European Article Number)
+ $ean = ismn_to_ean('1565921496');
+
+ #convert from EAN (European Article Number)
+ $ismn = ean_to_ismn('9781565921498');
+
+=head1 DESCRIPTION
+
+=head2 Methods
+
+=over 4
+
+=item new($ismn)
+
+The constructor accepts a scalar representing the ISMN.
+
+The string representing the ISMN may contain characters
+other than C<[0-9mM]>, although these will be removed in the
+internal representation. The resulting string must look
+like an ISMN - the first character is an 'M' and the
+following nine characters must be digits.
+
+The constructor attempts to determine the country
+code and the publisher code. If these data cannot
+be determined, the constructor sets C<$obj-E<gt>is_valid>
+to something other than C<GOOD_ISMN>.
+An object is still returned and it is up to the program
+to check C<$obj-E<gt>is_valid> for one of five values (which
+may be exported on demand). The actual values of these
+symbolic versions are the same as those from previous
+versions of this module which used literal values.
+
+ Business::ISMN::INVALID_PUBLISHER_CODE
+ Business::ISMN::BAD_CHECKSUM
+ Business::ISMN::GOOD_ISMN
+ Business::ISMN::BAD_ISMN
+
+The string passed as the ISMN need not be a valid ISMN as
+long as it superficially looks like one. This allows one to
+use the C<fix_checksum()> method. Despite the disclaimer in
+the discussion of that method, the author has found it
+extremely useful. One should check the validity of the ISMN
+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 ISMN, one can skip the object-oriented
+interface and use the C<is_valid_checksum()> function
+which is exportable on demand.
+
+If the constructor decides it cannot create an object, it
+returns C<undef>. It may do this if the string passed as the
+ISMN cannot be munged to the internal format meaning that it
+does not even come close to looking like an ISMN.
+
+=item ismn
+
+Returns the ISMN as a string
+
+=item publisher
+
+Returns the country associated with the publisher code.
+
+=item publisher_code
+
+Returns the publisher code or C<undef> if no publisher
+code was found.
+
+=item article_code
+
+Returns the article code or C<undef> if no article
+code was found.
+
+=item checksum
+
+Returns the checksum or C<undef> if no publisher
+code was found.
+
+=item hyphen_positions
+
+Returns the list of hyphen positions as determined from the
+country and publisher codes. the C<as_string> method provides
+a way to temporarily override these positions and to even
+forego them altogether.
+
+=item as_string(), as_string([])
+
+Return the ISMN as a string. This function takes an
+optional anonymous array (or array reference) that specifies
+the placement of hyphens in the string. An empty anonymous array
+produces a string with no hyphens. An empty argument list
+automatically hyphenates the ISMN based on the discovered
+publisher code. An ISMN that is not valid may
+produce strange results.
+
+The positions specified in the passed anonymous array
+are only used for one method use and do not replace
+the values specified by the constructor. The method
+assumes that you know what you are doing and will attempt
+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
+ignored.
+
+=item is_valid
+
+Returns C<Business::ISMN::GOOD_ISMN> if the checksum is valid and the
+country and publisher codes are defined.
+
+Returns C<Business::ISMN::BAD_CHECKSUM> if the ISMN does not pass
+the checksum test. The constructor accepts invalid ISMN's so that
+they might be fixed with C<fix_checksum>.
+
+Returns C<Business::ISMN::INVALID_PUBLISHER_CODE> if a publisher code
+could not be determined.
+
+Returns C<Business::ISMN::BAD_ISMN> if the string has no hope of ever
+looking like a valid ISMN. This might include strings such as C<"abc">,
+C<"123456">, and so on.
+
+=item is_valid_publisher_code
+
+Returns true if the publisher code is valid, and false otherwise.
+
+=item fix_checksum()
+
+Replace the tenth character with the checksum the
+corresponds to the previous nine digits. This does not
+guarantee that the ISMN corresponds to the product one
+thinks it does, or that the ISMN corresponds to any product
+at all. It only produces a string that passes the checksum
+routine. If the ISMN passed to the constructor was invalid,
+the error might have been in any of the other nine positions.
+
+=item $obj-E<gt>as_ean()
+
+Converts the ISMN to the equivalent EAN (European Article Number).
+No pricing extension is added. Returns the EAN as a string. This
+method can also be used as an exportable function since it checks
+its argument list to determine what to do.
+
+=item png_barcode()
+
+Creates a PNG image of the EAN13 barcode which corresponds to the
+ISMN. Returns the image as a string.
+
+=back
+
+=head2 EXPORTABLE FUNCTIONS
+
+Some functions can be used without the object interface. These
+do not use object technology behind the scenes.
+
+=over 4
+
+=item is_valid_checksum('M021765430')
+
+Takes the ISMN string and runs it through the checksum
+comparison routine. Returns C<Business::ISMN::GOOD_ISMN>
+if the ISMN is valid, C<Business::ISMN::BAD_CHECKSUM> if the
+string looks like an ISMN but has an invalid checksum, and
+C<Business::ISMN::BAD_ISMN> if the string does not look like
+an ISMN.
+
+=item ismn_to_ean('M021765430')
+
+Takes the ISMN string and converts it to the equivalent
+EAN string. This function checks for a valid ISMN and will return
+undef for invalid ISMNs, otherwise it returns the EAN as a string.
+Uses as_ean internally, which checks its arguments to determine
+what to do.
+
+=item ean_to_ismn('9790021765439')
+
+Takes the EAN string and converts it to the equivalent
+ISMN string. This function checks for a valid ISMN and will return
+undef for invalid ISMNs, otherwise it returns the EAN as a string.
+Uses as_ean internally, which checks its arguments to determine
+what to do.
+
+=back
+
+=head1 TO DO
+
+* i need more ISMN numbers for tests
+
+=head1 SOURCE AVAILABILITY
+
+This source is in Github:
+
+ http://github.com/briandfoy/business--isbn/tree/master
+
+=head1 AUTHOR
+
+brian d foy, C<< <[email protected]> >>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (c) 2001-2014, brian d foy, All Rights Reserved.
+
+You may redistribute this under the same terms as Perl itself.
+
+=cut
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Business-ISMN-1.11/lib/Data.pm
new/Business-ISMN-1.13/lib/Data.pm
--- old/Business-ISMN-1.11/lib/Data.pm 2007-01-10 04:47:51.000000000 +0100
+++ new/Business-ISMN-1.13/lib/Data.pm 1970-01-01 01:00:00.000000000 +0100
@@ -1,75 +0,0 @@
-package Business::ISBM::Data;
-use strict;
-# $Revision: 1.3 $
-# $Id: Data.pm,v 1.3 2007/01/10 03:47:51 comdog Exp $
-
-=head1 NAME
-
-Business::ISMN::Data - data pack for Business::ISMN
-
-=head1 SYNOPSIS
-
-see Business::ISMN
-
-=head1 DESCRIPTION
-
-See L<Business::ISMN>.
-
-=head1 AUTHOR
-
-brian d foy, C<< <[email protected]> >>
-
-=head1 COPYRIGHT AND LICENSE
-
-Copyright (c) 2005-2007 brian d foy. All rights reserved.
-
-This program is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
-=cut
-
-package Business::ISMN;
-use strict;
-
-use vars qw( %publisher_data @publisher_tuples );
-
-%publisher_data = (
-'AU' => [ ['075', undef], [2700, 2701], [67300, 67310], [720000, 720200],
[9009500, 9009799] ],
-'CA' => [ [53001, 53010], [706001, 706050], [9001301, 9001600] ],
-'CY' => [ [720300, 720320], [9009800, 9009850] ],
-'CZ' => [ [2600, 2605], [66050, 66100], [706500, 706600], [9004000, 9005000] ],
-'DE' => [ ['000', '025'], [2000, 2150], [50000, 52000], [700000, 705000],
[9000000, 9001000] ],
-'DK' => [ [66130, 66140], [706750, 706800], [9001801, 9001900] ],
-'ES' => [ [3500, 3507], [69200, 69224], [801200, 801219], [9013100, 9013119] ],
-'FI' => [ ['042', undef], [55001, 55020], [706300, 706349], [9001601, 9001700]
],
-'FR' => [ ['043', '048'], [2301, 2400], [56000, 56500] ],
-'GB' => [ ['050', '060'], [2201, 2300], [57000, 57999], [708001, 709000],
[9002000, 9002999] ],
-'GH' => [ [9008000, 9008100] ],
-'GR' => [ [69150, 69159], [801150, 801179], [9013030, 9013079] ],
-'HR' => [ [706700, 706710], [9005201, 9005250] ],
-'HU' => [ [55030, undef], [706251, 706260], [9005251, 9005260], ['080', undef]
],
-'IT' => [ ['039', '041'], [2151, 2200], [52001, 53000], [705001, 706000],
[9001001, 9001300] ],
-'JP' => [ [65001, undef] ],
-'LK' => [ [710000, 710100], [9006400, 9006500] ],
-'LT' => [ [59995, 59999], [706201, 706250] ],
-'LV' => [ [706650, 706660], [9005001, 9005100] ],
-'NO' => [ ['065', undef], [2610, 2617], [66101, 66115], [706680, 706690],
[9005101, 9005200] ],
-'PT' => [ [3000, undef], [707700, 707750], [9007500, 9007600] ],
-'RU' => [ [66000, 66055] ],
-'SE' => [ ['070', undef], [66150, 66170], [706850, 706900], [9006000, 9006200]
],
-'SI' => [ [709001, 709100], [9009000, 9009100] ],
-'SK' => [ [68500, 68520], [9010001, 9010050] ],
-'TR' => [ ['036', '037'], [3440, 3445], [69080, 69095], [801100, 801120],
[9013000, 9013010] ],
-'UA' => [ [707500, 707600], [9007000, 9007200] ],
-'US' => [ ['081', '099'], [3005, 3205], [58000, 58199], [60001, 60002],
[800000, 800199], [9012000, 9012099] ],
-);
-
-foreach my $key ( keys %publisher_data )
- {
- my @pairs = map { [ $key, @$_ ] } @{ $publisher_data{$key} };
- push @publisher_tuples, @pairs;
- }
-
-@publisher_tuples = sort { $a->[1] <=> $b->[1] } @publisher_tuples;
-
-1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Business-ISMN-1.11/lib/ISMN.pm
new/Business-ISMN-1.13/lib/ISMN.pm
--- old/Business-ISMN-1.11/lib/ISMN.pm 2007-10-26 05:01:06.000000000 +0200
+++ new/Business-ISMN-1.13/lib/ISMN.pm 1970-01-01 01:00:00.000000000 +0100
@@ -1,564 +0,0 @@
-# $Id: ISMN.pm,v 1.11 2007/10/26 03:01:06 comdog Exp $
-package Business::ISMN;
-use strict;
-
-use base qw(Exporter);
-use subs qw(
- _common_format _checksum is_valid_checksum
- INVALID_PUBLISHER_CODE
- BAD_CHECKSUM
- GOOD_ISMN
- BAD_ISMN
- );
-use vars qw( $VERSION @ISA @EXPORT_OK $debug %country_data
- $MAX_COUNTRY_CODE_LENGTH );
-
-use Carp qw(carp);
-use Exporter;
-use List::Util qw(sum);
-use Tie::Cycle;
-use Business::ISMN::Data;
-
-my $debug = 0;
-
-@EXPORT_OK = qw(is_valid_checksum ean_to_ismn ismn_to_ean
- INVALID_PUBLISHER_CODE BAD_CHECKSUM GOOD_ISMN BAD_ISMN);
-
-($VERSION) = q$Revision: 1.11 $ =~ m/(\d+\.\d+)\s*$/;
-
-sub INVALID_PUBLISHER_CODE { -3 };
-sub BAD_CHECKSUM { -1 };
-sub GOOD_ISMN { 1 };
-sub BAD_ISMN { 0 };
-
-my %Lengths = qw(
- 0 3
- 1 4
- 2 4
- 3 4
- 4 5
- 5 5
- 6 5
- 7 6
- 8 6
- 9 7
- );
-
-sub new
- {
- my $class = shift;
- my $common_data = _common_format shift;
-
- return unless defined $common_data;
-
- my $self = {};
- bless $self, $class;
-
- $self->{'ismn'} = $common_data;
- $self->{'positions'} = [1,undef,9];
-
- # we don't know if we have a valid publisher code,
- # so let's assume we don't
- $self->{'valid'} = INVALID_PUBLISHER_CODE;
-
- # let's check the publisher code.
- my $code_length = $Lengths{ substr( $self->{'ismn'}, 1, 1 ) };
- $self->{publisher_code} = substr(
- $self->{'ismn'},
- 1,
- $code_length
- );
-
- my $code_end = $code_length + 1;
-
- $self->{'positions'}[1] = $code_end;
-
- return $self unless $self->is_valid_publisher_code;
-
- # we have a good publisher code, so
- # assume we have a bad checksum until we check
- $self->{'valid'} = BAD_CHECKSUM;
-
- $self->{'article_code'} = substr( $self->{'ismn'}, $code_end, 9 -
$code_end );
- $self->{'checksum'} = substr( $self->{'ismn'}, -1, 1 );
-
- $self->{'valid'} = is_valid_checksum( $self->{'ismn'} );
-
- return $self;
- }
-
-
-#it's your fault if you muck with the internals yourself
-# none of these take arguments
-sub ismn () { my $self = shift; return $self->{'ismn'} }
-sub is_valid () { my $self = shift; return $self->{'valid'} }
-sub publisher () { my $self = shift; return $self->{'publisher'} }
-sub publisher_code () { my $self = shift; return $self->{'publisher_code'} }
-sub article_code () { my $self = shift; return $self->{'article_code'} }
-sub checksum () { my $self = shift; return $self->{'checksum'} }
-sub hyphen_positions () { my $self = shift; return @{$self->{'positions'}} }
-
-
-sub fix_checksum
- {
- my $self = shift;
-
- my $last_char = substr($self->{'ismn'}, 9, 1);
- my $checksum = _checksum $self->ismn;
-
- substr($self->{'ismn'}, 9, 1) = $checksum;
-
- $self->_check_validity;
-
- return 0 if $last_char eq $checksum;
- return 1;
- }
-
-sub as_string
- {
- my $self = shift;
- my $array_ref = shift;
-
- #this allows one to override the positions settings from the
- #constructor
- $array_ref = $self->{'positions'} unless ref $array_ref eq 'ARRAY';
-
- return unless $self->is_valid eq GOOD_ISMN;
- my $ismn = $self->ismn;
-
- foreach my $position ( sort { $b <=> $a } @$array_ref )
- {
- next if $position > 9 or $position < 1;
- substr($ismn, $position, 0) = '-';
- }
-
- return $ismn;
- }
-
-sub as_ean
- {
- my $self = shift;
-
- my $ismn = ref $self ? $self->as_string([]) : _common_format $self;
-
- return unless ( defined $ismn and length $ismn == 10 );
-
- # the M becomes a zero in bookland
- substr( $ismn, 0, 1 ) = '0';
-
- my $ean = '979' . substr($ismn, 0, 9);
-
- my $sum = 0;
- foreach my $index ( 0, 2, 4, 6, 8, 10 )
- {
- $sum += substr($ean, $index, 1);
- $sum += 3 * substr($ean, $index + 1, 1);
- }
-
- #take the next higher multiple of 10 and subtract the sum.
- #if $sum is 37, the next highest multiple of ten is 40. the
- #check digit would be 40 - 37 => 3.
- $ean .= ( 10 * ( int( $sum / 10 ) + 1 ) - $sum ) % 10;
-
- return $ean;
- }
-
-sub is_valid_publisher_code
- {
- my $self = shift;
- my $code = $self->publisher_code;
-
- my $success = 0;
-
- foreach my $tuple ( @publisher_tuples )
- {
- no warnings;
- next if( defined $tuple->[2] and $code > $tuple->[2] );
- last if $code < $tuple->[1];
- if( $code >= $tuple->[1] and $code <= $tuple->[2] )
- {
- $success = 1;
- $self->{'publisher'} = $tuple->[0];
- last;
- }
- }
-
- return $success;
- }
-
-sub is_valid_checksum
- {
- my $data = _common_format shift;
-
- return BAD_ISMN unless defined $data;
-
- return GOOD_ISMN if substr($data, 9, 1) eq _checksum $data;
-
- return BAD_CHECKSUM;
- }
-
-sub ean_to_ismn
- {
- my $ean = shift;
-
- $ean =~ s/[^0-9]//g;
-
- return unless length $ean == 13;
- return unless substr($ean, 0, 3) eq 979;
-
- #XXX: fix to change leading 0 back to M
- my $ismn = Business::ISMN->new( substr($ean, 3, 9) . '1' );
-
- $ismn->fix_checksum;
-
- return $ismn->as_string([]) if $ismn->is_valid;
-
- return;
- }
-
-
-sub ismn_to_ean
- {
- my $ismn = _common_format shift;
-
- return unless (defined $ismn and is_valid_checksum($ismn) eq GOOD_ISMN);
-
- return as_ean($ismn);
- }
-
-sub png_barcode
- {
- my $self = shift;
-
- my $ean = ismn_to_ean( $self->as_string([]) );
-
- eval "use GD::Barcode::EAN13";
- if( $@ )
- {
- carp "GD::Barcode::EAN13 required to make PNG barcodes";
- return;
- }
-
- my $image = GD::Barcode::EAN13->new($ean)->plot->png;
-
- return $image;
- }
-
-#internal function. you don't get to use this one.
-sub _check_validity
- {
- my $self = shift;
-
- if( is_valid_checksum $self->{'ismn'} eq GOOD_ISMN
- and defined $self->{'publisher_code'} )
- {
- $self->{'valid'} = GOOD_ISMN;
- }
- else
- {
- $self->{'valid'} = INVALID_PUBLISHER_CODE
- unless defined $self->{'publisher_code'};
- $self->{'valid'} = GOOD_ISMN
- unless is_valid_checksum $self->{'ismn'} ne GOOD_ISMN;
- }
- }
-
-#internal function. you don't get to use this one.
-sub _checksum
- {
- my $data = _common_format shift;
-
- tie my $factor, 'Tie::Cycle', [ 1, 3 ];
- return unless defined $data;
-
- my $sum = 9;
-
- foreach my $digit ( split //, substr( $data, 1, 8 ) )
- {
- my $mult = $factor;
- $sum += $digit * $mult;
- }
-
-
- #return what the check digit should be
- # the extra mod 10 turns 10 into 0.
- my $checksum = ( 10 - ($sum % 10) ) % 10;
-
- return $checksum;
- }
-
-#internal function. you don't get to use this one.
-sub _common_format
- {
- #we want uppercase X's
- my $data = uc shift;
-
- # get rid of everything except decimal digits and X
- # and leading M
- $data =~ s/[^0-9M]//g;
-
- return $1 if $data =~ m/
- ^
- (
- M
- \d{9}
- )
- $
- /x;
-
- return;
- }
-
-1;
-
-__END__
-
-=head1 NAME
-
-Business::ISMN - work with International Standard Music Numbers
-
-=head1 SYNOPSIS
-
- use Business::ISMN;
-
- $ismn_object = new Business::ISMN('M021765430');
- $ismn_object = new Business::ISMN('M-021-76543-0');
-
- #print the ISMN with hyphens at positions specified
- #by constructor
- print $ismn_object->as_string;
-
- #print the ISMN with hyphens at specified positions.
- #this not does affect the default positions
- print $ismn_object->as_string([]);
-
- #print the publisher or publisher code
- print $ismn->publisher;
- print $ismn->publisher_code;
-
- #check to see if the ISMN is valid
- $ismn_object->is_valid;
-
- #fix the ISMN checksum. BEWARE: the error might not be
- #in the checksum!
- $ismn_object->fix_checksum;
-
- # create an EAN13 barcode in PNG format
- $ismn_object->png_barcode;
-
- #EXPORTABLE FUNCTIONS
-
- use Business::ISMN qw( is_valid_checksum
- ismn_to_ean ean_to_ismn );
-
- #verify the checksum
- if( is_valid_checksum('0123456789')
- eq Business::ISMN::GOOD_ISMN )
- { ... }
-
- #convert to EAN (European Article Number)
- $ean = ismn_to_ean('1565921496');
-
- #convert from EAN (European Article Number)
- $ismn = ean_to_ismn('9781565921498');
-
-=head1 DESCRIPTION
-
-=head2 Methods
-
-=over 4
-
-=item new($ismn)
-
-The constructor accepts a scalar representing the ISMN.
-
-The string representing the ISMN may contain characters
-other than C<[0-9mM]>, although these will be removed in the
-internal representation. The resulting string must look
-like an ISMN - the first character is an 'M' and the
-following nine characters must be digits.
-
-The constructor attempts to determine the country
-code and the publisher code. If these data cannot
-be determined, the constructor sets C<$obj-E<gt>is_valid>
-to something other than C<GOOD_ISMN>.
-An object is still returned and it is up to the program
-to check C<$obj-E<gt>is_valid> for one of five values (which
-may be exported on demand). The actual values of these
-symbolic versions are the same as those from previous
-versions of this module which used literal values.
-
- Business::ISMN::INVALID_PUBLISHER_CODE
- Business::ISMN::BAD_CHECKSUM
- Business::ISMN::GOOD_ISMN
- Business::ISMN::BAD_ISMN
-
-The string passed as the ISMN need not be a valid ISMN as
-long as it superficially looks like one. This allows one to
-use the C<fix_checksum()> method. Despite the disclaimer in
-the discussion of that method, the author has found it
-extremely useful. One should check the validity of the ISMN
-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 ISMN, one can skip the object-oriented
-interface and use the C<is_valid_checksum()> function
-which is exportable on demand.
-
-If the constructor decides it cannot create an object, it
-returns C<undef>. It may do this if the string passed as the
-ISMN cannot be munged to the internal format meaning that it
-does not even come close to looking like an ISMN.
-
-=item ismn
-
-Returns the ISMN as a string
-
-=item publisher
-
-Returns the country associated with the publisher code.
-
-=item publisher_code
-
-Returns the publisher code or C<undef> if no publisher
-code was found.
-
-=item article_code
-
-Returns the article code or C<undef> if no article
-code was found.
-
-=item checksum
-
-Returns the checksum or C<undef> if no publisher
-code was found.
-
-=item hyphen_positions
-
-Returns the list of hyphen positions as determined from the
-country and publisher codes. the C<as_string> method provides
-a way to temporarily override these positions and to even
-forego them altogether.
-
-=item as_string(), as_string([])
-
-Return the ISMN as a string. This function takes an
-optional anonymous array (or array reference) that specifies
-the placement of hyphens in the string. An empty anonymous array
-produces a string with no hyphens. An empty argument list
-automatically hyphenates the ISMN based on the discovered
-publisher code. An ISMN that is not valid may
-produce strange results.
-
-The positions specified in the passed anonymous array
-are only used for one method use and do not replace
-the values specified by the constructor. The method
-assumes that you know what you are doing and will attempt
-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
-ignored.
-
-=item is_valid
-
-Returns C<Business::ISMN::GOOD_ISMN> if the checksum is valid and the
-country and publisher codes are defined.
-
-Returns C<Business::ISMN::BAD_CHECKSUM> if the ISMN does not pass
-the checksum test. The constructor accepts invalid ISMN's so that
-they might be fixed with C<fix_checksum>.
-
-Returns C<Business::ISMN::INVALID_PUBLISHER_CODE> if a publisher code
-could not be determined.
-
-Returns C<Business::ISMN::BAD_ISMN> if the string has no hope of ever
-looking like a valid ISMN. This might include strings such as C<"abc">,
-C<"123456">, and so on.
-
-=item is_valid_publisher_code
-
-Returns true if the publisher code is valid, and false otherwise.
-
-=item fix_checksum()
-
-Replace the tenth character with the checksum the
-corresponds to the previous nine digits. This does not
-guarantee that the ISMN corresponds to the product one
-thinks it does, or that the ISMN corresponds to any product
-at all. It only produces a string that passes the checksum
-routine. If the ISMN passed to the constructor was invalid,
-the error might have been in any of the other nine positions.
-
-=item $obj-E<gt>as_ean()
-
-Converts the ISMN to the equivalent EAN (European Article Number).
-No pricing extension is added. Returns the EAN as a string. This
-method can also be used as an exportable function since it checks
-its argument list to determine what to do.
-
-=item png_barcode()
-
-Creates a PNG image of the EAN13 barcode which corresponds to the
-ISMN. Returns the image as a string.
-
-=back
-
-=head2 EXPORTABLE FUNCTIONS
-
-Some functions can be used without the object interface. These
-do not use object technology behind the scenes.
-
-=over 4
-
-=item is_valid_checksum('M021765430')
-
-Takes the ISMN string and runs it through the checksum
-comparison routine. Returns C<Business::ISMN::GOOD_ISMN>
-if the ISMN is valid, C<Business::ISMN::BAD_CHECKSUM> if the
-string looks like an ISMN but has an invalid checksum, and
-C<Business::ISMN::BAD_ISMN> if the string does not look like
-an ISMN.
-
-=item ismn_to_ean('M021765430')
-
-Takes the ISMN string and converts it to the equivalent
-EAN string. This function checks for a valid ISMN and will return
-undef for invalid ISMNs, otherwise it returns the EAN as a string.
-Uses as_ean internally, which checks its arguments to determine
-what to do.
-
-=item ean_to_ismn('9790021765439')
-
-Takes the EAN string and converts it to the equivalent
-ISMN string. This function checks for a valid ISMN and will return
-undef for invalid ISMNs, otherwise it returns the EAN as a string.
-Uses as_ean internally, which checks its arguments to determine
-what to do.
-
-=back
-
-=head1 TO DO
-
-* i need more ISMN numbers for tests
-
-=head1 SOURCE AVAILABILITY
-
-This source is part of a SourceForge project which always has the
-latest sources in CVS, as well as all of the previous releases.
-
- http://sourceforge.net/projects/brian-d-foy/
-
-If, for some reason, I disappear from the world, one of the other
-members of the project can shepherd this module appropriately.
-
-=head1 AUTHOR
-
-brian d foy, C<< <[email protected]> >>
-
-=head1 COPYRIGHT AND LICENSE
-
-Copyright (c) 2001-2007, brian d foy, All Rights Reserved.
-
-You may redistribute this under the same terms as Perl itself.
-
-=cut
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Business-ISMN-1.11/t/ismn.t
new/Business-ISMN-1.13/t/ismn.t
--- old/Business-ISMN-1.11/t/ismn.t 2004-09-16 18:02:16.000000000 +0200
+++ new/Business-ISMN-1.13/t/ismn.t 2014-11-28 06:43:36.000000000 +0100
@@ -1,5 +1,3 @@
-# $Revision: 1.3 $
-
use Test::More tests => 18;
use Business::ISMN;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Business-ISMN-1.11/t/load.t
new/Business-ISMN-1.13/t/load.t
--- old/Business-ISMN-1.11/t/load.t 2004-09-16 18:02:59.000000000 +0200
+++ new/Business-ISMN-1.13/t/load.t 2014-11-28 06:43:36.000000000 +0100
@@ -1,11 +1,9 @@
-# $Id: load.t,v 1.3 2004/09/16 16:02:59 comdog Exp $
-BEGIN {
- @classes = qw(Business::ISMN Business::ISMN::Data);
- }
+use Test::More 0.95;
+
+my @classes = qw(Business::ISMN Business::ISMN::Data);
-use Test::More tests => scalar @classes;
-
-foreach my $class ( @classes )
- {
- print "bail out! Could not compile $class\n" unless use_ok( $class );
+foreach my $class ( @classes ) {
+ use_ok( $class ) or BAILOUT();
}
+
+done_testing();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Business-ISMN-1.11/t/pod.t
new/Business-ISMN-1.13/t/pod.t
--- old/Business-ISMN-1.11/t/pod.t 2004-09-01 22:42:05.000000000 +0200
+++ new/Business-ISMN-1.13/t/pod.t 2014-11-28 06:43:36.000000000 +0100
@@ -1,4 +1,3 @@
-#$Id: pod.t,v 1.2 2004/09/01 20:42:05 comdog Exp $
use Test::More;
eval "use Test::Pod 1.00";
plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Business-ISMN-1.11/t/pod_coverage.t
new/Business-ISMN-1.13/t/pod_coverage.t
--- old/Business-ISMN-1.11/t/pod_coverage.t 2005-03-07 21:13:39.000000000
+0100
+++ new/Business-ISMN-1.13/t/pod_coverage.t 2014-11-28 06:43:36.000000000
+0100
@@ -1,5 +1,3 @@
-# : pod_coverage.t,v 1.1 2005/03/04 13:08:26 comdog Exp
-
use Test::More;
eval "use Test::Pod::Coverage";
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Business-ISMN-1.11/t/prereq.t
new/Business-ISMN-1.13/t/prereq.t
--- old/Business-ISMN-1.11/t/prereq.t 2004-09-01 22:42:45.000000000 +0200
+++ new/Business-ISMN-1.13/t/prereq.t 2014-11-28 06:43:36.000000000 +0100
@@ -1,4 +1,3 @@
-#$Id: prereq.t,v 1.2 2004/09/01 20:42:45 comdog Exp $
use Test::More;
eval "use Test::Prereq";
plan skip_all => "Test::Prereq required to test dependencies" if $@;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Business-ISMN-1.11/t/test_manifest
new/Business-ISMN-1.13/t/test_manifest
--- old/Business-ISMN-1.11/t/test_manifest 2005-03-08 23:18:22.000000000
+0100
+++ new/Business-ISMN-1.13/t/test_manifest 2014-11-28 06:43:36.000000000
+0100
@@ -1,4 +1,3 @@
-# $Id: test_manifest,v 1.4 2005/03/08 22:18:22 comdog Exp $
load.t
pod.t
pod_coverage.t