Business-ISSN-1.005/000755 000765 000024 00000000000 14203601135 014315 5ustar00brianstaff000000 000000 Business-ISSN-1.005/LICENSE000644 000765 000024 00000021735 14203601132 015327 0ustar00brianstaff000000 000000 The Business::ISSN module is licensed under the same terms as perl itself, under the Artistic License 2.0. 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. Business-ISSN-1.005/CITATION.cff000644 000765 000024 00000001223 14203601132 016202 0ustar00brianstaff000000 000000 # This CITATION.cff file was generated with /Users/brian/bin/bmt # Tue Feb 15 19:55:02 2022 abstract: Business::ISSN - Perl extension for International Standard Serial Numbers authors: - alias: briandfoy email: bdfoy@cpan.org family-names: foy given-names: brian d orcid: 0000-0002-0283-8283 cff-version: 1.2.0 date-released: 2020-03-19 doi: 10.5281/zenodo.6098257 license: artistic_2 license-url: https://github.com/briandfoy/business-issn/LICENSE message: The GitHub page for this module provides formatted citations repository-code: https://github.com/briandfoy/business-issn title: The Business::ISSN Perl module type: software version: '1.004' Business-ISSN-1.005/Changes000644 000765 000024 00000000720 14203601132 015604 0ustar00brianstaff000000 000000 Revision history for Perl module Business::ISSN 1.005 2022-02-18T02:19:46Z * Refresh distro, fix license issue 1.004 2020-03-20T03:32:51Z * This went missing from CPAN because I deleted it 1.002 2016-12-05T18:59:45Z * Remove the prereq.t test. I'll do that locally. 1.001 2016-01-12T18:51:29Z * Freshen the module 0.91 - 2008-08-06 * module now maintained by brian d foy * modernized, fully tested, and fixed RT #38174 0.20 - 1999-02-09 * 1st version Business-ISSN-1.005/MANIFEST000644 000765 000024 00000000630 14203601135 015445 0ustar00brianstaff000000 000000 Changes CITATION.cff examples/placeholder.pl INSTALL.SKIP lib/Business/ISSN.pm LICENSE Makefile.PL MANIFEST This list of files MANIFEST.SKIP README.pod t/issn.t t/load.t t/pod.t t/pod_coverage.t t/test_manifest xt/changes.t xt/citation.t META.yml Module YAML meta-data (added by MakeMaker) META.json Module JSON meta-data (added by MakeMaker) Business-ISSN-1.005/t/000755 000765 000024 00000000000 14203601134 014557 5ustar00brianstaff000000 000000 Business-ISSN-1.005/xt/000755 000765 000024 00000000000 14203601134 014747 5ustar00brianstaff000000 000000 Business-ISSN-1.005/README.pod000644 000765 000024 00000010202 14203601132 015746 0ustar00brianstaff000000 000000 =pod =encoding utf8 =for HTML =for HTML =for HTML =for HTML =for HTML Coverage Status =for HTML =for HTML =for HTML =head1 The Business::ISSN module This is the I for the L Perl module. You're probably looking at this because you don't know where else to find what you're looking for. Read this once and you might never have to read one again for any Perl module. =head2 Documentation To read about L, look at the embedded documentation in the module itself. Inside the distribution, you can format it with L: % perldoc lib/Business/ISSN.pm If you have already installed the module, you can specify the module name instead of the file location: % perldoc Business::ISSN You can read the documentation and inspect the meta data at L. The standard module documentation has example uses in the SYNOPSIS section, but you can also look in the I directory (if it's there), or look at the test files in I. =head2 Installation You can install this module with a CPAN client, which will resolve and install the dependencies: % cpan Business::ISSN % cpanm Business::ISSN You can also install directly from the distribution directory, which will also install the dependencies: % cpan . % cpanm . You could install just this module manually: % perl Makefile.PL % make % make test % make install You probably don't want to do that unless you're fiddling with the module and only want to run the tests without installing anything. =head2 Source location The meta data, such as the source repository and bug tracker, is in I or the I files it creates. You can find that on those CPAN web interfaces, but you can also look at files directly in the source repository: =over 4 =item * L =back If you find a problem, file a ticket in the L: =over 4 =item * L =back =head2 Getting help Although I'm happy to hear from module users in private email, that's the best way for me to forget to do something. Besides the issue trackers, you can find help at L or L, both of which have many competent Perlers who can answer your question, almost in real time. They might not know the particulars of this module, but they can help you diagnose your problem. You might like to read L. =head2 Copyright and License You should have received a I file, but the license is also noted in the module files. About the only thing you can't do is pretend that you wrote code that you didn't. =head2 Good luck! Enjoy, brian d foy, bdfoy@cpan.org =cut Business-ISSN-1.005/MANIFEST.SKIP000644 000765 000024 00000002312 14203601132 016206 0ustar00brianstaff000000 000000 #!start included /usr/local/perls/perl-5.22.0/lib/5.22.0/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 \b_eumm/ # 7.05_05 and above # Avoid Module::Build generated and utility files. \bBuild$ \b_build/ \bBuild.bat$ \bBuild.COM$ \bBUILD.COM$ \bbuild.com$ # and Module::Build::Tiny generated files \b_build_params$ # Avoid temp and backup files. ~$ \.old$ \#$ \b\.# \.bak$ \.tmp$ \.# \.rej$ \..*\.sw.?$ # 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 prove files \B\.prove$ # Avoid MYMETA files ^MYMETA\. #!end included /usr/local/perls/perl-5.22.0/lib/5.22.0/ExtUtils/MANIFEST.SKIP \.?appveyor.yml \.releaserc \.lwpcookies \bMANIFEST\s\d \bChanges\s\d \.icloud$ \A\.github\b Business-ISSN-1.005/examples/000755 000765 000024 00000000000 14203601134 016132 5ustar00brianstaff000000 000000 Business-ISSN-1.005/META.yml000664 000765 000024 00000001546 14203601134 015575 0ustar00brianstaff000000 000000 --- abstract: 'Perl extension for International Standard Serial Numbers' author: - 'brian d foy ' build_requires: Test::More: '1' configure_requires: Exporter: '0' ExtUtils::MakeMaker: '6.64' File::Spec::Functions: '0' strict: '0' subs: '0' vars: '0' warnings: '0' dynamic_config: 1 generated_by: 'ExtUtils::MakeMaker version 7.62, CPAN::Meta::Converter version 2.150010' license: artistic_2 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: Business-ISSN no_index: directory: - t - inc requires: perl: '5.008' resources: bugtracker: https://github.com/briandfoy/business-issn/issues homepage: https://github.com/briandfoy/business-issn repository: https://github.com/briandfoy/business-issn.git version: '1.005' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' Business-ISSN-1.005/lib/000755 000765 000024 00000000000 14203601134 015062 5ustar00brianstaff000000 000000 Business-ISSN-1.005/Makefile.PL000644 000765 000024 00000005365 14203601132 016275 0ustar00brianstaff000000 000000 package Business::ISSN; use strict; use warnings; =encoding utf8 =head1 The build file for Business::ISSN This build file is a modulino; it works as both a build script and a module. To build the distribution, run this file normally: % perl Makefile.PL But, it's more interesting than that. You can load it with C and call C to get the data structure it passes to C: my $package = require '/path/to/Makefile.PL'; my $arguments = $package->arguments; Note that C-ing a file makes an entry in C<%INC> for exactly that name. If you try to C another file with the same name, even from a different path, C thinks it has already loaded the file. As such, I recommend you always require the full path to the file. The return value of the C is a package name (in this case, the name of the main module. Use that to call the C method. Even if this distribution needs a higher version of Perl, this bit only needs v5.8. You can play with the data structure with a primitive Perl. =cut use File::Spec::Functions qw(catfile); my $module = __PACKAGE__; ( my $dist = $module ) =~ s/::/-/g; my $github = 'https://github.com/briandfoy/business-issn'; my $main_file = catfile( 'lib', split /::/, "$module.pm" ); my %WriteMakefile = ( 'MIN_PERL_VERSION' => '5.008', 'NAME' => $module, 'ABSTRACT_FROM' => $main_file, 'VERSION_FROM' => $main_file, 'LICENSE' => 'artistic_2', 'AUTHOR' => 'brian d foy ', 'CONFIGURE_REQUIRES' => { 'Exporter' => '0', 'ExtUtils::MakeMaker' => '6.64', 'File::Spec::Functions' => '0', 'strict' => '0', 'subs' => '0', 'vars' => '0', 'warnings' => '0', }, 'BUILD_REQUIRES' => { }, 'TEST_REQUIRES' => { 'Test::More' => '1', }, 'PREREQ_PM' => { }, 'META_MERGE' => { 'meta-spec' => { version => 2 }, resources => { repository => { type => 'git', url => "$github.git", web => $github, }, bugtracker => { web => "$github/issues", }, homepage => $github, }, }, clean => { FILES => "$dist-*" }, ); sub arguments { \%WriteMakefile } do_it() unless caller; sub do_it { require File::Spec; my $MM ='ExtUtils::MakeMaker'; my $MM_version = eval{ "$MM " . $WriteMakefile{'CONFIGURE_REQUIRES'}{'ExtUtils::MakeMaker'} } || "$MM 6.64"; eval "use $MM_version; 1" or die "Could not load $MM_version: $@"; eval "use Test::Manifest 1.21" if -e File::Spec->catfile( qw(t test_manifest) ); my $arguments = arguments(); my $minimum_perl = $arguments->{MIN_PERL_VERSION} || '5.008'; eval "require $minimum_perl;" or die $@; WriteMakefile( %$arguments ); } no warnings; __PACKAGE__; Business-ISSN-1.005/INSTALL.SKIP000644 000765 000024 00000000156 14203601132 016112 0ustar00brianstaff000000 000000 README\.pod README.* # things that might be in local directories after fooling # around with them \.DS_Store Business-ISSN-1.005/META.json000664 000765 000024 00000003032 14203601135 015736 0ustar00brianstaff000000 000000 { "abstract" : "Perl extension for International Standard Serial Numbers", "author" : [ "brian d foy " ], "dynamic_config" : 1, "generated_by" : "ExtUtils::MakeMaker version 7.62, CPAN::Meta::Converter version 2.150010", "license" : [ "artistic_2" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : 2 }, "name" : "Business-ISSN", "no_index" : { "directory" : [ "t", "inc" ] }, "prereqs" : { "build" : { "requires" : {} }, "configure" : { "requires" : { "Exporter" : "0", "ExtUtils::MakeMaker" : "6.64", "File::Spec::Functions" : "0", "strict" : "0", "subs" : "0", "vars" : "0", "warnings" : "0" } }, "runtime" : { "requires" : { "perl" : "5.008" } }, "test" : { "requires" : { "Test::More" : "1" } } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/briandfoy/business-issn/issues" }, "homepage" : "https://github.com/briandfoy/business-issn", "repository" : { "type" : "git", "url" : "https://github.com/briandfoy/business-issn.git", "web" : "https://github.com/briandfoy/business-issn" } }, "version" : "1.005", "x_serialization_backend" : "JSON::PP version 4.06" } Business-ISSN-1.005/lib/Business/000755 000765 000024 00000000000 14203601134 016655 5ustar00brianstaff000000 000000 Business-ISSN-1.005/lib/Business/ISSN.pm000644 000765 000024 00000011717 14203601132 017774 0ustar00brianstaff000000 000000 package Business::ISSN; use strict; use warnings; no warnings; use subs qw(_common_format _checksum is_valid_checksum); use Exporter qw(import); our @EXPORT = qw(); our @EXPORT_OK = qw(is_valid_checksum); our $VERSION = '1.005'; sub new { my $class = shift; my $common_data = _common_format shift; return unless $common_data; my $self = bless {}, $class; $self->{'issn'} = $common_data; $common_data =~m/([0-9]{7,7})([0-9\dxX])$/; @{$self}{ qw(checksum code) } = ( $2, $1 ); $self->_check_validity; return $self; } sub _issn { $_[0]->{'issn'} } sub is_valid { $_[0]->{'valid'} } sub checksum { $_[0]->{'checksum'} } sub _hyphen_positions { 4 } sub fix_checksum { my $self = shift; my $debug = 1; my $last_char = substr($self->_issn, -1, 1); my $checksum = _checksum $self->_issn; substr( $self->{issn}, -1, 1) = $checksum; $self->_check_validity; return 0 if $last_char eq $checksum; return 1; } sub as_string { return unless $_[0]->is_valid; my $issn = $_[0]->_issn; substr($issn, $_[0]->_hyphen_positions, 0) = '-'; return $issn; } sub is_valid_checksum { my $data = _common_format shift; return 0 unless $data; return 1 if substr($data, -1, 1) eq _checksum $data; return 0; } sub _check_validity { $_[0]->{'valid'} = is_valid_checksum( $_[0]->_issn ); } sub _checksum { my $data = _common_format shift; return unless $data; my @digits = split //, $data; my $sum = 0; foreach( reverse 2..8 ) # oli 10 { $sum += $_ * (shift @digits); } #return what the check digit should be my $checksum = (11 - ($sum % 11))%11; $checksum = 'X' if $checksum == 10; return $checksum; } sub _common_format { #we want uppercase X's my $data = uc shift; #get rid of everything except decimal digits and X $data =~ s/[^0-9X]//g; return $data if $data =~ m/^[0-9]{7}[0-9X]\z/; return; } 1; __END__ =encoding utf8 =head1 NAME Business::ISSN - Perl extension for International Standard Serial Numbers =head1 SYNOPSIS use Business::ISSN; $issn_object = Business::ISSN->new('1456-5935'); $issn_object = Business::ISSN->new('14565935'); # print the ISSN (with hyphen) print $issn_object->as_string; # check to see if the ISSN is valid $issn_object->is_valid; #fix the ISSN checksum. BEWARE: the error might not be #in the checksum! $issn_object->fix_checksum; #EXPORTABLE FUNCTIONS use Business::ISSN qw( is_valid_checksum ); #verify the checksum if( is_valid_checksum('01234567') ) { ... } =head1 DESCRIPTION =over 4 =item new($issn) The constructor accepts a scalar representing the ISSN. The string representing the ISSN may contain characters other than [0-9xX], although these will be removed in the internal representation. The resulting string must look like an ISSN - the first seven characters must be digits and the eighth character must be a digit, 'x', or 'X'. The string passed as the ISSN need not be a valid ISSN as long as it superficially looks like one. This allows one to use the C method. One should check the validity of the ISSN with C rather than relying on the return value of the constructor. If all one wants to do is check the validity of an ISSN, one can skip the object-oriented interface and use the c function which is exportable on demand. If the constructor decides it can't create an object, it returns undef. It may do this if the string passed as the ISSN can't be munged to the internal format. =item $obj->checksum Return the ISSN checksum. =item $obj->as_string Return the ISSN as a string. A terminating 'x' is changed to 'X'. =item $obj->is_valid Returns 1 if the checksum is valid. Returns 0 if the ISSN does not pass the checksum test. The constructor accepts invalid ISSN's so that they might be fixed with C. =item $obj->fix_checksum Replace the eighth character with the checksum the corresponds to the previous seven digits. This does not guarantee that the ISSN corresponds to the product one thinks it does, or that the ISSN corresponds to any product at all. It only produces a string that passes the checksum routine. If the ISSN passed to the constructor was invalid, the error might have been in any of the other nine positions. =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('01234567') Takes the ISSN string and runs it through the checksum comparison routine. Returns 1 if the ISSN is valid, 0 otherwise. =back =head1 AUTHOR Currently maintained by brian d foy C<< >>. Original module by Sami Poikonen, based on Business::ISBN by brian d foy. This module is released under the terms of the Perl Artistic License. =head1 COPYRIGHT AND LICENSE Copyright © 1999-2021, brian d foy . All rights reserved. You may redistribute this under the terms of the Artistic License 2.0. =cut Business-ISSN-1.005/examples/placeholder.pl000644 000765 000024 00000000130 14203601132 020741 0ustar00brianstaff000000 000000 #!/usr/bin/perl # See the module synopsis until I can create some interesting examples Business-ISSN-1.005/xt/citation.t000644 000765 000024 00000001011 14203601132 016735 0ustar00brianstaff000000 000000 # This xt/citation.t file was generated with /Users/brian/bin/bmt # Tue Feb 15 19:55:02 2022 use strict; use Test::More; my $file = 'CITATION.cff'; SKIP: { my $rc = eval { require YAML; YAML->VERSION('1.26'); 1 }; skip "Need YAML to test $file", 1 unless $rc; subtest citations => sub { ok( -e $file, "$file exists" ); my $data = eval { YAML::LoadFile( $file ) }; my $error = $@; ok( defined $data, "Loaded data from $file" ) or diag( "Error loading $file: $@" ); }; } done_testing(); Business-ISSN-1.005/xt/changes.t000644 000765 000024 00000000203 14203601132 016535 0ustar00brianstaff000000 000000 use Test::More; eval 'use Test::CPAN::Changes'; plan skip_all => 'Test::CPAN::Changes required for this test' if $@; changes_ok(); Business-ISSN-1.005/t/pod.t000644 000765 000024 00000000201 14203601132 015515 0ustar00brianstaff000000 000000 use Test::More; eval "use Test::Pod 1.00"; plan skip_all => "Test::Pod 1.00 required for testing POD" if $@; all_pod_files_ok(); Business-ISSN-1.005/t/load.t000644 000765 000024 00000000300 14203601132 015652 0ustar00brianstaff000000 000000 BEGIN { @classes = qw(Business::ISSN); } use Test::More tests => scalar @classes; foreach my $class ( @classes ) { print "Bail out! $class did not compile\n" unless use_ok( $class ); } Business-ISSN-1.005/t/issn.t000755 000765 000024 00000003440 14203601132 015722 0ustar00brianstaff000000 000000 #!/usr/bin/perl use warnings; use strict; use Test::More 'no_plan'; my $class = 'Business::ISSN'; use_ok( $class, qw(is_valid_checksum) ); # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Things that should work { my @valid_issns = qw( 0355-4325 1553-667X ); foreach my $issn ( @valid_issns ) { my $obj = $class->new( $issn ); isa_ok( $obj, $class ); ok( $obj->is_valid, "ISSN $issn is valid" ); is( $obj->checksum, substr( $issn, -1, 1 ), "checksum returns right value" ); is( $obj->as_string, $issn, "as_string matches original" ); ok( is_valid_checksum( $issn ), "is_valid_checksum returns true for good issn" ); ok( ! $obj->fix_checksum, "fix_checksum returns false for good issn" ); } } # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Things that shouldn't work at all { my @invalid_issns = qw( 0355-4323 abcd pwer-1234 ); foreach my $issn ( @invalid_issns ) { my $obj = $class->new( $issn ); ok( ! eval { $obj->is_valid }, "ISSN $issn is not valid" ); ok( ! is_valid_checksum( $issn ), "is_valid_checksum returns false for bad issn" ); } } # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Things that we can fix { my @invalid_issns = ( [ qw( 0355-4323 0355-4325 ) ], [ qw( 1553-6673 1553-667X ) ], ); foreach my $pair ( @invalid_issns ) { my $obj = $class->new( $pair->[0] ); isa_ok( $obj, $class ); ok( ! eval { $obj->is_valid }, "ISSN $pair->[0] is not valid" ); ok( ! defined $obj->as_string, "as_string returns undef before we fix issn" ); ok( ! is_valid_checksum( $pair->[0] ), "is_valid_checksum returns false for fixable issn" ); ok( $obj->fix_checksum, "fix_checksum returns true" ); ok( $obj->is_valid, "ISSN $pair->[1] is now valid" ); is( $obj->as_string, $pair->[1], "as_string returns fixed issn" ); } }Business-ISSN-1.005/t/test_manifest000644 000765 000024 00000000043 14203601132 017342 0ustar00brianstaff000000 000000 load.t pod.t pod_coverage.t issn.t Business-ISSN-1.005/t/pod_coverage.t000644 000765 000024 00000000271 14203601132 017377 0ustar00brianstaff000000 000000 use Test::More; eval "use Test::Pod::Coverage 1.00"; plan skip_all => "Test::Pod::Coverage 1.00 required for testing POD coverage" if $@; all_pod_coverage_ok();