briandfoy / business-isbn Goto Github PK
View Code? Open in Web Editor NEW(Perl) Deal with ISBNs
License: Other
(Perl) Deal with ISBNs
License: Other
Business-ISBN-3.002 has weird license declaration. While LICENSE file quotes Artistic 2.0 license, lib/Business/ISBN.pm (and other module) files declares "same terms as Perl itself" and that means GPL+ or Artistic 1 (see http://dev.perl.org/licenses/).
The current wordings implies that lib/Business/ISBN.pm (and other module) files are covered by GPL+ or Artistic 1 licenses and the other files like Makefile.PL, examples are covered by Artistic 2.0 license.
Is that really what the author wants?
Hello, it doesn't seem possible to check the checksum on invalid ISBN that have failed for one of the following checks, prefix, group code, publisher code or article code.
The is_valid_checksum method only works if the constructor has set the checksum value, which never happens if the isbn fails one of the other checks. The documentation seems to imply that is_valid_checksum will work even if the ISBN isn't considered valid... but maybe I'm just reading that wrong.
Maybe the docs just need to be more clear about the fact that it will only return GOOD_ISBN for valid checksums if the isbn is also valid. Unless fix_checksum is called first?
=item is_valid_checksum
Returns C<Business::ISBN::GOOD_ISBN> for valid checksums and
C<Business::ISBN::BAD_CHECKSUM> otherwise. This does not guarantee
that the rest of the ISBN is actually assigned to a book.
=cut
sub is_valid_checksum {
my $self = shift;
cluck "is_valid_checksum: Didn't get object!" unless ref $self;
no warnings 'uninitialized';
return GOOD_ISBN if $self->checksum eq $self->_checksum;
return BAD_CHECKSUM;
}
My use case is that Baker & Taylor generates their own ISBN's for DVD's that they sell. Those ISBN's have valid checksums, but fail the group code check. I would like to just check the checksum for those ISBN's, but that doesn't seem possible without calling fix_checksum first, which isn't intuitive since I don't need to fix the checksum, I just need the current checksum loaded.
Reference: https://bugs.launchpad.net/evergreen/+bug/1559281
Thanks
Josh
After studying your changes for 2.010, it seems to be sane to downgrade the Mojo requirement to recommends, but add a requirement or recommendation for LWP::Simple.
This is only really a minor niggle.
But URI
is declared as a dependency, but nothing in the code appears to use it.
So this seems like good grounds to either document why its needed or remove the requirement.
use Business::ISBN;
use Data::Dumper;
my $isbn = Business::ISBN->new('9798986969305');
warn Data::Dumper::Dumper( $isbn->is_valid );
This outputs an empty string:
$VAR1 = '';
Hi!
I suddenly experienced that some new ISBN13s are not recognized by Business::ISBN
module, it may be related to group 9916, in following example first ISBN is fine but second is not.
use Business::ISBN;
foreach my $wannabe ( qw/ 9789985984093 9789916120453 / ) {
say "W: $wannabe ?";
my $isbn = Business::ISBN->new( $wannabe );
say $isbn->as_string . " GROUP CODE: " . $isbn->group_code;
say "GROUP: " . $isbn->group;
}
I checked out, that the second ISBN is correct for 2 different checkers:
http://www.hahnlibrary.net/libraries/isbncalc.html
https://www.isbn-check.com/
Wbr,
Gunnar
perl -Mversion -E' say for sort { version->parse($a) <=> version->parse($b) }
qw( 2.01 2.02 2.07 2.08 2.09 2.09_01 2.09_02 2.010 2.010_01 )'
2.01 # oldest
2.010
2.010_01
2.02
2.07
2.08
2.09
2.09_01
2.09_02 # newest
When I check for new versions of the modules I build, I look at what CPAN is offering. Occasionally, there are multiple versions on offer from search.cpan and I can see that one is not intended a stable release. But for Business-ISBN only 2.010 is found, and yet the revision history says "Promote to a developer release".
The test t/errors.t
is failing after update of Business-ISBN-Data from 20210112.006 to 20230316.001.
# Failed test 'ISBN 9786316294241 error text mentions 'group''
# at t/errors.t line 17.
# 'Invalid publisher code'
# doesn't match '(?^:group)'
# Failed test 'ISBN 9786316294241 has a bad group'
# at t/errors.t line 18.
# Failed test 'ISBN 6316294247 error text mentions 'group''
# at t/errors.t line 17.
# 'Invalid publisher code'
# doesn't match '(?^:group)'
# Failed test 'ISBN 6316294247 has a bad group'
# at t/errors.t line 18.
# Looks like you failed 4 tests of 11.
# Failed test 'bad_group'
# at t/errors.t line 28.
# Looks like you failed 1 test of 4.
t/errors.t ...............
http://www.cpantesters.org/cpan/report/4b92b5ce-c8bd-11ed-9a72-66e2458b2395
See https://rt.cpan.org/Ticket/Display.html?id=110568
Probably related to #2
Perling the code
#!/usr/bin/perl -l
use Business::ISBN;
print Business::ISBN->new('9783863267667')->as_string;
spits out 978-3-86326-766-7. At the same time, the publisher typesets the ISBN of “Moderne Betriebssysteme” differently: 978-3-8632-6766-7. I asked the publisher around 2021-07-21 and the International ISBN agency on 2021-07-26. Pearson has not answered so far, and the International ISBN agency said it would inform the German one. Which of the two spellings with hyphens is correct™?
Crosspost: briandfoy/business-isbn-data#10 .
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.