1Business::ISSN(3) User Contributed Perl Documentation Business::ISSN(3)
2
3
4
6 Business::ISSN - Perl extension for International Standard Serial
7 Numbers
8
10 use Business::ISSN;
11 $issn_object = Business::ISSN->new('1456-5935');
12
13 $issn_object = Business::ISSN->new('14565935');
14
15 # print the ISSN (with hyphen)
16 print $issn_object->as_string;
17
18 # check to see if the ISSN is valid
19 $issn_object->is_valid;
20
21 #fix the ISSN checksum. BEWARE: the error might not be
22 #in the checksum!
23 $issn_object->fix_checksum;
24
25 #EXPORTABLE FUNCTIONS
26
27 use Business::ISSN qw( is_valid_checksum );
28
29 #verify the checksum
30 if( is_valid_checksum('01234567') ) { ... }
31
33 new($issn)
34 The constructor accepts a scalar representing the ISSN.
35
36 The string representing the ISSN may contain characters other than
37 [0-9xX], although these will be removed in the internal
38 representation. The resulting string must look like an ISSN - the
39 first seven characters must be digits and the eighth character must
40 be a digit, 'x', or 'X'.
41
42 The string passed as the ISSN need not be a valid ISSN as long as
43 it superficially looks like one. This allows one to use the
44 "fix_checksum" method.
45
46 One should check the validity of the ISSN with "is_valid()" rather
47 than relying on the return value of the constructor.
48
49 If all one wants to do is check the validity of an ISSN, one can
50 skip the object-oriented interface and use the
51 c<is_valid_checksum()> function which is exportable on demand.
52
53 If the constructor decides it can't create an object, it returns
54 undef. It may do this if the string passed as the ISSN can't be
55 munged to the internal format.
56
57 $obj->checksum
58 Return the ISSN checksum.
59
60 $obj->as_string
61 Return the ISSN as a string.
62
63 A terminating 'x' is changed to 'X'.
64
65 $obj->is_valid
66 Returns 1 if the checksum is valid.
67
68 Returns 0 if the ISSN does not pass the checksum test. The
69 constructor accepts invalid ISSN's so that they might be fixed with
70 "fix_checksum".
71
72 $obj->fix_checksum
73 Replace the eighth character with the checksum the corresponds to
74 the previous seven digits. This does not guarantee that the ISSN
75 corresponds to the product one thinks it does, or that the ISSN
76 corresponds to any product at all. It only produces a string that
77 passes the checksum routine. If the ISSN passed to the constructor
78 was invalid, the error might have been in any of the other nine
79 positions.
80
81 EXPORTABLE FUNCTIONS
82 Some functions can be used without the object interface. These do not
83 use object technology behind the scenes.
84
85 is_valid_checksum('01234567')
86 Takes the ISSN string and runs it through the checksum comparison
87 routine. Returns 1 if the ISSN is valid, 0 otherwise.
88
90 Currently maintained by brian d foy "<brian.d.foy@gmail.com>".
91
92 Original module by Sami Poikonen, based on Business::ISBN by brian d
93 foy.
94
95 This module is released under the terms of the Perl Artistic License.
96
98 Copyright © 1999-2018, brian d foy <bdfoy@cpan.org>. All rights
99 reserved.
100
101 You may redistribute this under the terms of the Artistic License 2.0.
102
103
104
105perl v5.32.1 2021-01-26 Business::ISSN(3)