@@ -1,36 +1,14 @@
-Revision history for WWW::Scraper::ISBN::Driver
-===============================================
+Revision history for Perl extension WWW::Scraper::ISBN::Driver.
-0.22 2014-04-18
- - extract conversion methods into the driver.
- - extended test suite.
- - fixed distribution name in META.
+0.18 - 01/05/2005 - A. Schamp
+ Made corrections to documentation, applied patches
+ submitted by Barbie.
-0.21 2014-04-07
- - added LICENSE file.
- - added deprecation warning.
+0.17 - ? - A. Schamp
+ Lost in the shuffle
-0.20 2013-08-27
- - further extended test suite.
+0.16 - 04/06/2004 - A. Schamp
+ Removed exporter and perl version stuff
+ by user request
-0.19 2013-08-25
- - New Maintainer: Barbie.
- - move module into lib directory structure.
- - change file dates changed to meet W3CDTF standards.
- - reworked Makefile.PL for clarity.
- - added META.json and updated META.yml.
- - extended test suite.
- - Fixed RT#51708, thanks to Frank Wiegand (FWIE)
-
-0.18 2005-05-01
- - Made corrections to documentation, applied patches
- submitted by Barbie.
-
-0.17 2004-04-13
- - Lost in the shuffle
-
-0.16 2004-06-04
- - Removed exporter and perl version stuff by user request
-
-0.15 2004-03-30
- - Began using Changes file ;), updated documentation
+0.15 - Began using Changes file ;), updated documentation
@@ -0,0 +1,235 @@
+package WWW::Scraper::ISBN::Driver;
+
+use strict;
+use warnings;
+use Carp;
+
+our $VERSION = '0.18';
+
+
+# Preloaded methods go here.
+sub new {
+ my $proto = shift;
+ my $class = ref($proto) || $proto;
+ my $self = {};
+ $self->{FOUND} = 0;
+ $self->{VERBOSITY} = 0;
+ $self->{BOOK} = undef;
+ $self->{ERROR} = "";
+ bless ($self, $class);
+ return $self;
+}
+
+sub found {
+ my $self = shift;
+ if (@_) { $self->{FOUND} = shift };
+ return $self->{FOUND};
+}
+
+sub verbosity {
+ my $self = shift;
+ if (@_) { $self->{VERBOSITY} = shift };
+ return $self->{VERBOSITY};
+}
+
+sub book {
+ my $self = shift;
+ if (@_) { $self->{BOOK} = shift };
+ return $self->{BOOK};
+}
+
+sub error {
+ my $self = shift;
+ if (@_) { $self->{ERROR} = shift };
+ return $self->{ERROR};
+}
+
+sub search {
+ croak("Child class must overload 'search()' method.");
+}
+
+# a generic method for storing the error & setting not found
+
+sub handler {
+ my $self = shift;
+ if (@_) {
+ $self->{ERROR} = shift;
+ print "Error: $self->{ERROR}\n" if $self->verbosity;
+ };
+ return $self->found(0);
+}
+
+1;
+__END__
+
+=head1 NAME
+
+WWW::Scraper::ISBN::Driver - Driver class for WWW::Scraper::ISBN module.
+
+=head1 SYNOPSIS
+
+ use WWW::Scraper::ISBN::Driver;
+ $driver = WWW::Scraper::ISBN::Driver->new();
+ $driver->search($isbn);
+ if ($driver->found) { ... }
+ $driver->verbosity(1);
+ my $book = $driver->book();
+ print $book('title');
+ print $driver->error;
+
+=head1 REQUIRES
+
+Requires the following modules be installed:
+
+ Carp
+
+=head1 DESCRIPTION
+
+This is a base class, all site-specific drivers should inherit its members and methods. Driver
+subclasses named 'C<$name>' should be packaged as C<WWW::Scraper::ISBN::$name_Driver>, e.g.
+C<WWW::Scraper::ISBN::LOC_Driver> for LOC (Library of Congress) driver. Each driver need only implement the
+C<search()> method, though they may have as many other methods as they need to get their job done. Only
+C<search()> will be called by C<< WWW::Scraper::ISBN->search() >>.
+
+=head2 Standard Fields
+
+It is important that the different drivers return at least a core set of information, though they may return
+additional information. The following self-explanatory fields should exist in C<$driver->book>:
+
+=over 4
+
+=item author
+
+=item title
+
+=item isbn
+
+=back
+
+Additional standard fields may be added in the future. 'volume' and 'edition' are common. In some cases, there may be no
+information available for 'volume' or 'edition', and so these may be set to the empty string. However, they must still
+be set in the hash!
+
+=head2 Expiration
+
+Due to the dynamic, ever-changing nature of the web, it is highly likely that the site from which many of these drivers glean
+their information will change. Hopefully, driver maintainers will keep drivers up to date, but they will all expire, and may
+behave unexpectedly. Keep this in mind if the driver continually returns weird results.
+
+=head2 Export
+
+None by default.
+
+=head1 METHODS
+
+The following methods are provided by C<WWW::Scraper::ISBN::Driver>:
+
+=over 4
+
+=item C<new()>
+
+ $drv = WWW::Scraper::ISBN::Driver->new()
+
+Class constructor. Creates new driver object and returns a reference to it. Sets the following default
+values:
+
+ found = 0;
+ verbosity = 0;
+ book = undef;
+ error = "";
+
+=item C<found() or found($bool)>
+
+ if ($drv->found) { # ... }
+ $drv->found(1);
+
+Accessor/Mutator method for handling the search status of this record. This is 0 by default, and should
+only be set true if search was deemed successful and C<< $driver->book >> contains appropriate information.
+
+=item C<verbosity() or verbosity($level)>
+
+ $driver->verbosity(3);
+ if ($driver->verbosity == 2) { print "blah blah blah"; }
+
+Accessor/Mutator method for handling the verbosity level to be generated by this driver as it is going.
+This can be used to print useful information by the driver as it is running.
+
+=item C<book() or book($hashref)>
+
+ my $book = $drv->book;
+ print $book->{'title'};
+ print $book->{'author'};
+ $another_book = { 'title' => "Some book title",
+ 'author' => "Author of some book"
+ };
+ $drv->book( $another_book );
+
+Accessor/Mutator method for handling the book information retrieved by the driver. The driver should create an anonymous hash
+containing the standard fields. C<< WWW::Scraper::ISBN->search >> sets the C<< WWW::Scraper::ISBN::Record->book() >> field to this
+value.
+
+=item C<error() or error($error_string)>
+
+ print $driver->error;
+ $driver->error("Invalid ISBN number, or some similar error.");
+
+Accessor/Mutator method for handling any errors which occur during the search. The search drivers may add errors to record
+fields, which may be useful in gleaning information about failed searches.
+
+=item C<search($isbn)>
+
+ my $record = $driver->search("123456789X");
+
+Searches for information on the given ISBN number. Each driver must define its own search routine, doing whatever is necessary to
+retrieve the desired information. If found, it should set C<< $driver->found >> and C<< $driver->book >> accordingly.
+
+=item C<handler() or handler($error_string)>
+
+ $driver->handler("Invalid ISBN number, or some similar error.");
+
+A generic handler method for handling errors. If given an error string, will store as per C<< $self->error($error_string) >> and print on the standard output if verbosity is set. Returns C<< $self->found(0) >>.
+
+=head1 KNOWN DRIVERS
+
+=over 4
+
+L<WWW::Scraper::ISBN::LOC_Driver> - Search Library of Congress online catalog
+
+L<WWW::Scraper::ISBN::ISBNnu_Driver> - Search www.isbn.nu
+
+L<WWW::Scraper::ISBN::Pearson_Driver> - Search Pearson Education's online catalog
+
+L<WWW::Scraper::ISBN::ORA_Driver> - Search O'Reilly and Associates's online catalog
+
+L<WWW::Scraper::ISBN::AmazonUK_Driver> - Search Amazon's UK online catalog
+
+L<WWW::Scraper::ISBN::AmazonUS_Driver> - Search Amazon's US online catalog
+
+L<WWW::Scraper::ISBN::Yahoo_Driver> - Search Yahoo! Books' online catalog
+=back
+
+=head1 SEE ALSO
+
+=over 4
+
+L<WWW::Scraper::ISBN>
+
+L<WWW::Scraper::ISBN::Record>
+
+No mailing list or website currently available. Primary development done through CSX
+( L<http://csx.calvin.edu/> ).
+
+=back
+
+=head1 AUTHOR
+
+Andy Schamp, E<lt>andy@schamp.netE<gt>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright 2004 by Andy Schamp
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
@@ -1,7 +0,0 @@
-LICENSE FOR WWW-Scraper-ISBN-Driver
-
-Copyright © 2004-2013 Andy Schamp, andy@schamp.net
-Copyright © 2013-2014 Barbie for Miss Barbell Productions.
-
-This distribution is free software; you can redistribute it and/or
-modify it under the Artistic Licence v2.
@@ -1,16 +1,7 @@
Changes
-lib/WWW/Scraper/ISBN/Driver.pm
-LICENSE
+Driver.pm
Makefile.PL
MANIFEST
-META.json
-META.yml
README
-t/01base.t
-t/10object.t
-t/11convert.t
-t/90podtest.t
-t/91podcover.t
-t/94metatest.t
-t/95changedate.t
-t/96metatest.t
+t/1.t
+META.yml Module meta-data (added by MakeMaker)
@@ -1,63 +0,0 @@
-{
- "name": "WWW-Scraper-ISBN-Driver",
- "version": "0.22",
- "abstract": "Driver class for WWW::Scraper::ISBN module",
- "author": [
- "Andy Schamp <andy@schamp.net>",
- "Barbie <barbie@cpan.org>"
- ],
-
- "license": "artistic_2",
- "dynamic_config" : 0,
- "release_status" : "stable",
- "meta-spec": {
- "version": "2",
- "url": "http://search.cpan.org/dist/CPAN-Meta/lib/CPAN/Meta/Spec.pm"
- },
- "generated_by": "Hand 1.0",
- "keywords" : [
- "isbn",
- "books"
- ],
-
- "prereqs" : {
- "runtime" : {
- "requires" : {
- "perl": "5.006",
- "Carp": "1.00"
- }
- },
- "test" : {
- "requires": {
- "IO::File": "0",
- "Test::More": "0.70"
- },
- "recommends": {
- "Test::CPAN::Meta": "0",
- "Test::CPAN::Meta::JSON": "0",
- "Test::Pod": "1.00",
- "Test::Pod::Coverage": "0.08"
- }
- }
- },
-
- "provides": {
- "WWW::Scraper::ISBN::Driver": {
- "file": "lib/WWW/Scraper/ISBN/Driver.pm",
- "version": "0.22"
- }
- },
- "no_index": {
- "directory": ["t","examples"]
- },
-
- "resources": {
- "license": "http://www.perlfoundation.org/artistic_license_2_0",
- "bugtracker": { "web": "http://rt.cpan.org/Public/Dist/Display.html?Name=WWW-Scraper-ISBN-Driver" },
- "repository": {
- "url": "git://github.com/barbie/www-scraper-isbn-driver.git",
- "web": "http://github.com/barbie/www-scraper-isbn-driver",
- "type": "git"
- }
- }
-}
@@ -1,43 +1,11 @@
---- #YAML:1.0
-name: WWW-Scraper-ISBN-Driver
-version: 0.22
-abstract: Driver class for WWW::Scraper::ISBN module
-author:
- - Andy Schamp <andy@schamp.net>
- - Barbie <barbie@cpan.org>
-
-license: artistic_2
-distribution_type: module
-installdirs: site
-
+# http://module-build.sourceforge.net/META-spec.html
+#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
+name: WWW-Scraper-ISBN-Driver
+version: 0.18
+version_from: Driver.pm
+installdirs: site
requires:
- perl: 5.006
- Carp: 1.00
-recommends:
- Test::CPAN::Meta: 0
- Test::CPAN::Meta::JSON: 0
- Test::Pod: 1.00
- Test::Pod::Coverage: 0.08
-build_requires:
- IO::File: 0
- Test::More: 0.70
-
-provides:
- WWW::Scraper::ISBN::Driver:
- file: lib/WWW/Scraper/ISBN/Driver.pm
- version: 0.22
-
-no_index:
- directory:
- - t
- - examples
-
-resources:
- license: http://www.perlfoundation.org/artistic_license_2_0
- bugtracker: http://rt.cpan.org/Public/Dist/Display.html?Name=WWW-Scraper-ISBN-Driver
- repository: http://github.com/barbie/www-scraper-isbn-driver
+ Carp: 1
-meta-spec:
- version: 1.4
- url: http://module-build.sourceforge.net/META-spec-v1.4.html
-generated_by: Hand 1.0
+distribution_type: module
+generated_by: ExtUtils::MakeMaker version 6.20
@@ -1,25 +1,12 @@
-#!/usr/bin/perl
-
-use strict;
-use warnings;
-use 5.006;
-
use ExtUtils::MakeMaker;
-
+# See lib/ExtUtils/MakeMaker.pm for details of how to influence
+# the contents of the Makefile that is written.
WriteMakefile(
- AUTHOR => 'Barbie <barbie@cpan.org>',
- NAME => 'WWW-Scraper-ISBN-Driver',
- VERSION_FROM => 'lib/WWW/Scraper/ISBN/Driver.pm',
- ABSTRACT => 'Driver class for WWW::Scraper::ISBN module',
- NO_META => 1,
- PREREQ_PM => {
-
- # runtime prereqs
- 'Carp' => '1.00',
-
- # build/test prereqs
- 'IO::File' => '0',
- 'Test::More' => '0.70'
-
- }
+ 'NAME' => 'WWW::Scraper::ISBN::Driver',
+ 'VERSION_FROM' => 'Driver.pm', # finds $VERSION
+ 'PREREQ_PM' => {
+ Carp => 1.0
+ },
+ ($] >= 5.005 ? ## Add these new keywords supported since 5.005
+ (AUTHOR => 'Andy Schamp <andy@schamp.net>') : ()),
);
@@ -1,21 +1,13 @@
-WWW-Scraper-ISBN-Driver
-=======================
+WWW/Scraper/ISBN/Driver version 0.15
+====================================
WWW::Scraper::ISBN::Driver - Driver class for WWW::Scraper::ISBN module.
-WARNING:
-
-This distribution will be deprecated in the near future. The module within is
-to be merged into the main WWW-Scraper-ISBN distribution.
-
-DESCRIPTION
-
-This is a base class, from which all site-specific drivers should inherit its
-members and methods. Driver subclasses named 'C<$name>' should be packaged as
-WWW::Scraper::ISBN::$name_Driver, e.g. WWW::Scraper::ISBN::LOC_Driver for the
-LOC (Library of Congress) driver. Each driver need only implement the search()
-method, though they may have as many other methods as they need to get their
-job done. Only search() will be called by WWW::Scraper::ISBN->search().
+This is a base class, all site-specific drivers should inherit its members and methods. Driver
+subclasses named '$name' should be packaged as WWW::Scraper::ISBN::$name_Driver, e.g.
+WWW::Scraper::ISBN::LOC_Driver for LOC (Library of Congress) driver. Each driver need only implement the
+search() method, though they may have as many other methods as they need to get their job done. Only
+search() will be called by WWW::Scraper::ISBN->search()
INSTALLATION
@@ -34,8 +26,8 @@ This module requires these other modules and libraries:
COPYRIGHT AND LICENCE
- Copyright (C) 2004-2013 Andy Schamp, andy@schamp.net
- Copyright (C) 2013-2014 Barbie, barbie@cpan.org
+Copyright 2004 by Andy Schamp (andy@schamp.net)
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself.
- This distribution is free software; you can redistribute it and/or
- modify it under the Artistic Licence v2.
@@ -1,334 +0,0 @@
-package WWW::Scraper::ISBN::Driver;
-
-use strict;
-use warnings;
-
-our $VERSION = '0.22';
-
-#----------------------------------------------------------------------------
-# Library Modules
-
-use Carp;
-
-#----------------------------------------------------------------------------
-# Public API
-
-# Preloaded methods go here.
-sub new {
- my $proto = shift;
- my $class = ref($proto) || $proto;
-
- my $self = {
- FOUND => 0,
- VERBOSITY => 0,
- BOOK => undef,
- ERROR => ''
- };
-
- bless ($self, $class);
- return $self;
-}
-
-sub found { my $self = shift; return $self->_accessor('FOUND',@_) }
-sub verbosity { my $self = shift; return $self->_accessor('VERBOSITY',@_) }
-sub book { my $self = shift; return $self->_accessor('BOOK',@_) }
-sub error { my $self = shift; return $self->_accessor('ERROR',@_) }
-
-sub _accessor {
- my $self = shift;
- my $accessor = shift;
- if (@_) { $self->{$accessor} = shift };
- return $self->{$accessor};
-}
-
-sub search {
- croak(q{Child class must overload 'search()' method.});
-}
-
-#----------------------------------------------------------------------------
-# Internal Class methods
-
-# a generic method for storing the error & setting not found
-sub handler {
- my $self = shift;
- if (@_) {
- $self->{ERROR} = shift;
- print "Error: $self->{ERROR}\n" if $self->verbosity;
- };
- return $self->found(0);
-}
-
-sub convert_to_ean13 {
- my $self = shift;
- my $isbn = shift;
- my $prefix;
-
- return unless(length $isbn == 10 || length $isbn == 13);
-
- if(length $isbn == 13) {
- return if($isbn !~ /^(978|979)(\d{10})$/);
- ($prefix,$isbn) = ($1,$2);
- } else {
- return if($isbn !~ /^(\d{10}|\d{9}X)$/);
- $prefix = '978';
- }
-
- my $isbn13 = $prefix . $isbn;
- chop($isbn13);
- my @isbn = split(//,$isbn13);
- my ($lsum,$hsum) = (0,0);
- while(@isbn) {
- $hsum += shift @isbn;
- $lsum += shift @isbn;
- }
-
- my $csum = ($lsum * 3) + $hsum;
- $csum %= 10;
- $csum = 10 - $csum if($csum != 0);
-
- return $isbn13 . $csum;
-}
-
-sub convert_to_isbn10 {
- my $self = shift;
- my $ean = shift;
- my ($isbn,$isbn10);
-
- return unless(length $ean == 10 || length $ean == 13);
-
- if(length $ean == 13) {
- return if($ean !~ /^(?:978|979)(\d{9})\d$/);
- ($isbn,$isbn10) = ($1,$1);
- } else {
- return if($ean !~ /^(\d{9})[\dX]$/);
- ($isbn,$isbn10) = ($1,$1);
- }
-
- my ($csum, $pos, $digit) = (0, 0, 0);
- for ($pos = 9; $pos > 0; $pos--) {
- $digit = $isbn % 10;
- $isbn /= 10; # Decimal shift ISBN for next time
- $csum += ($pos * $digit);
- }
- $csum %= 11;
- $csum = 'X' if ($csum == 10);
- return $isbn10 . $csum;
-}
-
-sub is_valid {
- my $self = shift;
- my $isbn = shift or return 0;
-
- # validate and convert into EAN13 format
- my $ean = $self->convert_to_ean13($isbn);
- return 0
- if(!$ean || (length $isbn == 13 && $isbn ne $ean)
- || (length $isbn == 10 && $isbn ne $self->convert_to_isbn10($ean)));
-
- return 1;
-}
-
-1;
-
-__END__
-
-=head1 NAME
-
-WWW::Scraper::ISBN::Driver - Driver class for WWW::Scraper::ISBN module.
-
-=head1 WARNING
-
-This distribution will be deprecated in the near future. The module within is
-to be merged into the main WWW-Scraper-ISBN distribution.
-
-=head1 SYNOPSIS
-
- use WWW::Scraper::ISBN::Driver;
-
- $driver = WWW::Scraper::ISBN::Driver->new();
- $driver->search($isbn);
-
- if ($driver->found) { ... }
- $driver->verbosity(1);
-
- my $book = $driver->book();
- print $book('title');
- print $driver->error;
-
-=head1 REQUIRES
-
-Requires the following modules be installed:
-
- Carp
-
-=head1 DESCRIPTION
-
-This is a base class, from which all site-specific drivers should inherit its
-members and methods. Driver subclasses named 'C<$name>' should be packaged as
-C<WWW::Scraper::ISBN::$name_Driver>, e.g. C<WWW::Scraper::ISBN::LOC_Driver>
-for the LOC (Library of Congress) driver. Each driver need only implement the
-C<search()> method, though they may have as many other methods as they need to
-get their job done. Only C<search()> will be called by
-C<< WWW::Scraper::ISBN->search() >>.
-
-=head2 Standard Fields
-
-It is important that the different drivers return at least a core set of
-information, though they may return additional information. The following
-self-explanatory fields should exist in C<< $driver->book >>:
-
-=over 4
-
-=item author
-
-=item title
-
-=item isbn
-
-=back
-
-In some cases, there may be no information for these fields, and so these may
-be set to the empty string. However, they must still be set in the hash!
-
-Additional standard fields may be added in the future. 'pages', 'weight',
-'height', 'depth and 'description' are common.
-
-=head2 Expiration
-
-Due to the dynamic, ever-changing nature of the web, it is highly likely that
-the site from which many of these drivers glean their information will change.
-Hopefully, driver maintainers will keep drivers up to date, but they will all
-expire, and may behave unexpectedly. Keep this in mind if the driver
-continually returns weird results.
-
-=head1 METHODS
-
-The following methods are provided by C<WWW::Scraper::ISBN::Driver>:
-
-=over 4
-
-=item C<new()>
-
- $drv = WWW::Scraper::ISBN::Driver->new()
-
-Class constructor. Creates new driver object and returns a reference to it.
-Sets the following default values:
-
- found = 0;
- verbosity = 0;
- book = undef;
- error = '';
-
-=item C<found() or found($bool)>
-
- if ($drv->found) { # ... }
- $drv->found(1);
-
-Accessor/Mutator method for handling the search status of this record. This is
-0 by default, and should only be set true if search was deemed successful and
-C<< $driver->book >> contains appropriate information.
-
-=item C<verbosity() or verbosity($level)>
-
- $driver->verbosity(3);
- if ($driver->verbosity == 2) { print 'blah blah blah'; }
-
-Accessor/Mutator method for handling the verbosity level to be generated by
-this driver as it is going. This can be used to print useful information by
-the driver as it is running.
-
-=item C<book() or book($hashref)>
-
- my $book = $drv->book;
- print $book->{'title'};
- print $book->{'author'};
- $another_book = { 'title' => 'Some book title',
- 'author' => "Author of some book"
- };
- $drv->book( $another_book );
-
-Accessor/Mutator method for handling the book information retrieved by the
-driver. The driver should create an anonymous hash containing the standard
-fields. C<< WWW::Scraper::ISBN->search >> sets the
-C<< WWW::Scraper::ISBN::Record->book() >> field to this value.
-
-=item C<error() or error($error_string)>
-
- print $driver->error;
- $driver->error('Invalid ISBN number, or some similar error.');
-
-Accessor/Mutator method for handling any errors which occur during the search.
-The search drivers may add errors to record fields, which may be useful in
-gleaning information about failed searches.
-
-=item C<search($isbn)>
-
- my $record = $driver->search('123456789X');
-
-Searches for information on the given ISBN number. Each driver must define its
-own search routine, doing whatever is necessary to retrieve the desired
-information. If found, it should set C<< $driver->found >> and
-C<< $driver->book >> accordingly.
-
-=item C<handler() or handler($error_string)>
-
- $driver->handler('Invalid ISBN number, or some similar error.');
-
-A generic handler method for handling errors. If given an error string, will
-store as per C<< $self->error($error_string) >> and print on the standard
-output if verbosity is set. Returns C<< $self->found(0) >>.
-
-=item C<convert_to_ean13($isbn)>
-
-Given a 10/13 character ISBN, this function will return the correct 13 digit
-ISBN, also known as EAN13.
-
-=item C<convert_to_isbn10($isbn)>
-
-Given a 10/13 character ISBN, this function will return the correct 10 digit
-ISBN.
-
-=item C<is_valid($isbn)>
-
-Given a 10/13 character ISBN, this function will return 1 if it considers it
-looks like a valid ISBN, otherwise returns 0.
-
-=back
-
-=head1 KNOWN DRIVERS
-
-The current list of known drivers can be installed via the following Bundle:
-
-=over 4
-
-L<Bundle::WWW::Scraper::ISBN::Drivers>
-
-=back
-
-If you create a driver, please post a GitHub pull request or create an RT
-ticket against the Bundle distribution.
-
-=head1 SEE ALSO
-
-=over 4
-
-L<WWW::Scraper::ISBN>
-
-L<WWW::Scraper::ISBN::Record>
-
-=back
-
-=head1 AUTHOR
-
- 2004-2013 Andy Schamp, E<lt>andy@schamp.netE<gt>
- 2013-2014 Barbie, E<lt>barbie@cpan.orgE<gt>
-
-=head1 COPYRIGHT AND LICENSE
-
- Copyright 2004-2013 by Andy Schamp
- Copyright 2013-2014 by Barbie
-
- This distribution is free software; you can redistribute it and/or
- modify it under the Artistic Licence v2.
-
-=cut
@@ -1,8 +0,0 @@
-#!/usr/bin/perl -w
-use strict;
-
-use Test::More tests => 1;
-
-BEGIN {
- use_ok( 'WWW::Scraper::ISBN::Driver' );
-}
@@ -0,0 +1,15 @@
+# Before `make install' is performed this script should be runnable with
+# `make test'. After `make install' it should work as `perl 1.t'
+
+#########################
+
+# change 'tests => 1' to 'tests => last_test_to_print';
+
+use Test::More tests => 1;
+BEGIN { use_ok('WWW::Scraper::ISBN::Driver') };
+
+#########################
+
+# Insert your test code below, the Test::More module is use()ed here so read
+# its man page ( perldoc Test::More ) for help writing this test script.
+
@@ -1,45 +0,0 @@
-#!/usr/bin/perl -w
-use strict;
-
-use Test::More tests => 21;
-
-use WWW::Scraper::ISBN::Driver;
-
-my $driver = WWW::Scraper::ISBN::Driver->new();
-isa_ok($driver,'WWW::Scraper::ISBN::Driver');
-my $driver2 = $driver->new();
-isa_ok($driver2,'WWW::Scraper::ISBN::Driver');
-
-my %defaults = (
- found => 0,
- verbosity => 0,
- book => undef,
- error => ''
-);
-
-for my $method (qw( found verbosity book error )) {
- is($driver->$method(),$defaults{$method},".. default test for $method");
- is($driver->$method('value'),'value',".. value test for $method");
-}
-
-eval { $driver->search() };
-like($@,qr/Child class/);
-
-$driver->found(1);
-is($driver->found,1);
-is($driver->handler('this is an error'),0);
-is($driver->found,0);
-is($driver->error,'this is an error');
-is($driver->handler(),0);
-is($driver->error,'this is an error'); # stays the same, if no other error given
-
-# now with verbose off
-
-$driver->verbosity(0);
-
-eval { $driver->search() };
-like($@,qr/Child class/);
-
-is($driver->handler('this is still an error'),0);
-is($driver->found,0);
-is($driver->error,'this is still an error');
@@ -1,38 +0,0 @@
-#!/usr/bin/perl -w
-use strict;
-
-use Test::More tests => 26;
-use WWW::Scraper::ISBN::Driver;
-
-###########################################################
-
-my %isbn = (
- '098765432X' => { ean13 => '9780987654328', isbn10 => '0987654322' },
- '0987654322' => { ean13 => '9780987654328', isbn10 => '0987654322' },
- '0987654321' => { ean13 => '9780987654328', isbn10 => '0987654322' },
- '0571239560' => { ean13 => '9780571239566', isbn10 => '0571239560' },
-
- '9780571239566' => { ean13 => '9780571239566', isbn10 => '0571239560' },
- '9780571239567' => { ean13 => '9780571239566', isbn10 => '0571239560' },
- '9780571239580' => { ean13 => '9780571239580', isbn10 => '0571239587' },
-
- '9790571239589' => { ean13 => '9790571239589', isbn10 => '0571239587' },
- '9790577229560' => { ean13 => '9790577229560', isbn10 => '0577229567' },
-
- '9790579239567' => { ean13 => '9790579239567', isbn10 => '057923956X' },
-
- '978057123956' => { ean13 => undef, isbn10 => undef },
- '9990571239567' => { ean13 => undef, isbn10 => undef },
- '098765432Z' => { ean13 => undef, isbn10 => undef },
-);
-
-###########################################################
-# Internal tests
-
-my $driver = WWW::Scraper::ISBN::Driver->new();
-for my $isbn (keys %isbn) {
- is($driver->convert_to_ean13($isbn), $isbn{$isbn}{ean13} ,".. isbn 13 convert for $isbn");
- is($driver->convert_to_isbn10($isbn),$isbn{$isbn}{isbn10},".. isbn 10 convert for $isbn");
-}
-
-###########################################################
@@ -1,12 +0,0 @@
-#!/usr/bin/perl -w
-use strict;
-
-use Test::More;
-
-# Skip if doing a regular install
-plan skip_all => "Author tests not required for installation"
- unless ( $ENV{AUTOMATED_TESTING} );
-
-eval "use Test::Pod 1.00";
-plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;
-all_pod_files_ok();
@@ -1,12 +0,0 @@
-#!/usr/bin/perl -w
-use strict;
-
-use Test::More;
-
-# Skip if doing a regular install
-plan skip_all => "Author tests not required for installation"
- unless ( $ENV{AUTOMATED_TESTING} );
-
-eval "use Test::Pod::Coverage 0.08";
-plan skip_all => "Test::Pod::Coverage 0.08 required for testing POD coverage" if $@;
-all_pod_coverage_ok();
@@ -1,28 +0,0 @@
-#!/usr/bin/perl -w
-use strict;
-
-use Test::More;
-
-# Skip if doing a regular install
-plan skip_all => "Author tests not required for installation"
- unless ( $ENV{AUTOMATED_TESTING} );
-
-eval "use Test::CPAN::Meta";
-plan skip_all => "Test::CPAN::Meta required for testing META.yml" if $@;
-
-plan 'no_plan';
-
-my $meta = meta_spec_ok(undef,undef,@_);
-
-use WWW::Scraper::ISBN::Driver;
-my $version = $WWW::Scraper::ISBN::Driver::VERSION;
-
-is($meta->{version},$version,
- 'META.yml distribution version matches');
-
-if($meta->{provides}) {
- for my $mod (keys %{$meta->{provides}}) {
- is($meta->{provides}{$mod}{version},$version,
- "META.yml entry [$mod] version matches");
- }
-}
@@ -1,40 +0,0 @@
-#!/usr/bin/perl -w
-use strict;
-
-use Test::More;
-use IO::File;
-
-# Skip if doing a regular install
-plan skip_all => "Author tests not required for installation"
- unless ( $ENV{AUTOMATED_TESTING} );
-
-my $fh = IO::File->new('Changes','r') or plan skip_all => "Cannot open Changes file";
-
-plan 'no_plan';
-
-use WWW::Scraper::ISBN::Driver;
-my $version = $WWW::Scraper::ISBN::Driver::VERSION;
-
-my $latest = 0;
-while(<$fh>) {
- next unless(m!^\d!);
- $latest = 1 if(m!^$version!);
-
- # 2012-08-26T01:02 or 2012-08-26T01:02:03 or 2012-08-26T01:02:03.04 or 2012-08-26T01:02+01:00
-
- like($_, qr!^
- \d[\d._]+\s+ # version
- ( \d{4}-\d{2}-\d{2} # 2012-08-26 - YYYY-MM-DD
- ( T\d{2}:\d{2} # T01:02 - Thh:mm
- ( :\d{2} # :02 - :ss
- ( \.\d+ # .2 - .ss (microseconds)
- )?
- )?
- ( (Z|[-+]\d+:\d+) # +01:00 - timezone
- )?
- )?
- )
- \s*$!x,'... version has a date');
-}
-
-is($latest,1,'... latest version not listed');
@@ -1,28 +0,0 @@
-#!/usr/bin/perl -w
-use strict;
-
-use Test::More;
-
-# Skip if doing a regular install
-plan skip_all => "Author tests not required for installation"
- unless ( $ENV{AUTOMATED_TESTING} );
-
-eval "use Test::CPAN::Meta::JSON";
-plan skip_all => "Test::CPAN::Meta::JSON required for testing META.json files" if $@;
-
-plan 'no_plan';
-
-my $meta = meta_spec_ok(undef,undef,@_);
-
-use WWW::Scraper::ISBN::Driver;
-my $version = $WWW::Scraper::ISBN::Driver::VERSION;
-
-is($meta->{version},$version,
- 'META.json distribution version matches');
-
-if($meta->{provides}) {
- for my $mod (keys %{$meta->{provides}}) {
- is($meta->{provides}{$mod}{version},$version,
- "META.json entry [$mod] version matches");
- }
-}