./PaxHeaders.16263/Biblio-SICI-0.040000644000175100001440000000013212265322761014475 xustar000000000000000030 mtime=1389733361.879916458 30 atime=1389733361.876916427 30 ctime=1389733361.879916458 Biblio-SICI-0.04/0000755000175100001440000000000012265322761013707 5ustar00develusers00000000000000Biblio-SICI-0.04/PaxHeaders.16263/README0000644000175100001440000000013212265322761015275 xustar000000000000000030 mtime=1389733361.876916427 30 atime=1389733361.876916427 30 ctime=1389733361.876916427 Biblio-SICI-0.04/README0000644000175100001440000000052412265322761014570 0ustar00develusers00000000000000 This archive contains the distribution Biblio-SICI, version 0.04: Provides methods for assembling, parsing, manipulating and serialising SICIs This software is copyright (c) 2014 by Heiko Jansen. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Biblio-SICI-0.04/PaxHeaders.16263/Changes0000644000175100001440000000013212265322761015710 xustar000000000000000030 mtime=1389733361.876916427 30 atime=1389733361.876916427 30 ctime=1389733361.876916427 Biblio-SICI-0.04/Changes0000644000175100001440000000050012265322761015175 0ustar00develusers00000000000000 0.04 2014-01-14 22:02:39 Europe/Berlin - Fix compatibility with Moo <= 1.000008 which did not allow simple scalars as default values 0.03 2014-01-12 17:00:16 Europe/Berlin - Get rid of File::Find::Rule dependency; use in-core File::Find 0.01 2014-01-11 21:09:48 Europe/Berlin - Initial release Biblio-SICI-0.04/PaxHeaders.16263/LICENSE0000644000175100001440000000013212265322761015422 xustar000000000000000030 mtime=1389733361.877916437 30 atime=1389733361.877916437 30 ctime=1389733361.877916437 Biblio-SICI-0.04/LICENSE0000644000175100001440000004365312265322761014727 0ustar00develusers00000000000000This software is copyright (c) 2014 by Heiko Jansen. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Terms of the Perl programming language system itself a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" --- The GNU General Public License, Version 1, February 1989 --- This software is Copyright (c) 2014 by Heiko Jansen. This is free software, licensed under: The GNU General Public License, Version 1, February 1989 GNU GENERAL PUBLIC LICENSE Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. 51 Franklin St, Suite 500, Boston, MA 02110-1335 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. The General Public License applies to the Free Software Foundation's software and to any other program whose authors commit to using it. You can use it for your programs, too. When we speak of free software, we are referring to freedom, not price. Specifically, the General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of a such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any work containing the Program or a portion of it, either verbatim or with modifications. Each licensee is addressed as "you". 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this General Public License and to the absence of any warranty; and give any other recipients of the Program a copy of this General Public License along with the Program. You may charge a fee for the physical act of transferring a copy. 2. You may modify your copy or copies of the Program or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains the Program or any part thereof, either with or without modifications, to be licensed at no charge to all third parties under the terms of this General Public License (except that you may choose to grant warranty protection to some or all third parties, at your option). c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the simplest and most usual way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this General Public License. d) You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. Mere aggregation of another independent work with the Program (or its derivative) on a volume of a storage or distribution medium does not bring the other work under the scope of these terms. 3. You may copy and distribute the Program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 1 and 2 above provided that you also do one of the following: a) accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal charge for the cost of distribution) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. 4. You may not copy, modify, sublicense, distribute or transfer the Program except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Program is void, and will automatically terminate your rights to use the Program under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. 5. By copying, distributing or modifying the Program (or any work based on the Program) you indicate your acceptance of this license to do so, and all its terms and conditions. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. 7. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of the license which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the license, you may choose any version ever published by the Free Software Foundation. 8. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to humanity, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19xx name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (a program to direct compilers to make passes at assemblers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice That's all there is to it! --- The Artistic License 1.0 --- This software is Copyright (c) 2014 by Heiko Jansen. This is free software, licensed under: The Artistic License 1.0 The Artistic License Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: - "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. - "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder. - "Copyright Holder" is whoever is named in the copyright or copyrights for the package. - "You" is you, if you're thinking about copying or distributing this Package. - "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) - "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as ftp.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) accompany any non-standard executables with their corresponding Standard Version executables, giving the non-standard executables non-standard names, and clearly documenting the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whomever generated them, and may be sold commercially, and may be aggregated with this Package. 7. C or perl subroutines supplied by you and linked into this Package shall not be considered part of this Package. 8. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End Biblio-SICI-0.04/PaxHeaders.16263/dist.ini0000644000175100001440000000013212265322761016061 xustar000000000000000030 mtime=1389733361.877916437 30 atime=1389733361.877916437 30 ctime=1389733361.877916437 Biblio-SICI-0.04/dist.ini0000644000175100001440000000077212265322761015361 0ustar00develusers00000000000000name = Biblio-SICI author = Heiko Jansen license = Perl_5 copyright_holder = Heiko Jansen copyright_year = 2014 version = 0.04 [@Basic] [MetaJSON] [MetaResources] repository.web = https://github.com/heikojansen/biblio-sici repository.url = https://github.com/heikojansen/biblio-sici.git repository.type = git [NextRelease] [PkgVersion] [PodWeaver] [PodSyntaxTests] [Prereqs] Moo = 0 Business::ISSN = 0 Try::Tiny = 0 perl = 5.010001 Text::Unidecode = 0 Text::Undiacritic = 0 Biblio-SICI-0.04/PaxHeaders.16263/META.yml0000644000175100001440000000013212265322761015666 xustar000000000000000030 mtime=1389733361.877916437 30 atime=1389733361.877916437 30 ctime=1389733361.877916437 Biblio-SICI-0.04/META.yml0000644000175100001440000000116412265322761015162 0ustar00develusers00000000000000--- abstract: 'Provides methods for assembling, parsing, manipulating and serialising SICIs' author: - 'Heiko Jansen ' build_requires: {} configure_requires: ExtUtils::MakeMaker: 6.30 dynamic_config: 0 generated_by: 'Dist::Zilla version 5.006, CPAN::Meta::Converter version 2.133380' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: Biblio-SICI requires: Business::ISSN: 0 Moo: 0 Text::Undiacritic: 0 Text::Unidecode: 0 Try::Tiny: 0 perl: 5.010001 resources: repository: https://github.com/heikojansen/biblio-sici.git version: 0.04 Biblio-SICI-0.04/PaxHeaders.16263/MANIFEST0000644000175100001440000000013212265322761015546 xustar000000000000000030 mtime=1389733361.877916437 30 atime=1389733361.877916437 30 ctime=1389733361.877916437 Biblio-SICI-0.04/MANIFEST0000644000175100001440000000061112265322761015036 0ustar00develusers00000000000000Changes LICENSE MANIFEST META.json META.yml Makefile.PL README dist.ini dist.ini~ lib/Biblio/SICI.pm lib/Biblio/SICI/ContributionSegment.pm lib/Biblio/SICI/ControlSegment.pm lib/Biblio/SICI/ItemSegment.pm lib/Biblio/SICI/Role/RecursiveLink.pm lib/Biblio/SICI/Role/ValidSegment.pm lib/Biblio/SICI/Util.pm t/001_compile.t t/002_util.t t/003_parse.t t/004_assemble_basic.t t/release-pod-syntax.t Biblio-SICI-0.04/PaxHeaders.16263/dist.ini~0000644000175100001440000000013212265322761016257 xustar000000000000000030 mtime=1389733361.878916447 30 atime=1389733361.878916447 30 ctime=1389733361.878916447 Biblio-SICI-0.04/dist.ini~0000644000175100001440000000077212265322761015557 0ustar00develusers00000000000000name = Biblio-SICI author = Heiko Jansen license = Perl_5 copyright_holder = Heiko Jansen copyright_year = 2014 version = 0.03 [@Basic] [MetaJSON] [MetaResources] repository.web = https://github.com/heikojansen/biblio-sici repository.url = https://github.com/heikojansen/biblio-sici.git repository.type = git [NextRelease] [PkgVersion] [PodWeaver] [PodSyntaxTests] [Prereqs] Moo = 0 Business::ISSN = 0 Try::Tiny = 0 perl = 5.010001 Text::Unidecode = 0 Text::Undiacritic = 0 Biblio-SICI-0.04/PaxHeaders.16263/META.json0000644000175100001440000000013212265322761016036 xustar000000000000000030 mtime=1389733361.878916447 30 atime=1389733361.878916447 30 ctime=1389733361.878916447 Biblio-SICI-0.04/META.json0000644000175100001440000000227212265322761015333 0ustar00develusers00000000000000{ "abstract" : "Provides methods for assembling, parsing, manipulating and serialising SICIs", "author" : [ "Heiko Jansen " ], "dynamic_config" : 0, "generated_by" : "Dist::Zilla version 5.006, CPAN::Meta::Converter version 2.133380", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "Biblio-SICI", "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "6.30" } }, "develop" : { "requires" : { "Test::Pod" : "1.41" } }, "runtime" : { "requires" : { "Business::ISSN" : "0", "Moo" : "0", "Text::Undiacritic" : "0", "Text::Unidecode" : "0", "Try::Tiny" : "0", "perl" : "5.010001" } } }, "release_status" : "stable", "resources" : { "repository" : { "type" : "git", "url" : "https://github.com/heikojansen/biblio-sici.git", "web" : "https://github.com/heikojansen/biblio-sici" } }, "version" : "0.04" } Biblio-SICI-0.04/PaxHeaders.16263/Makefile.PL0000644000175100001440000000013212265322761016367 xustar000000000000000030 mtime=1389733361.878916447 30 atime=1389733361.878916447 30 ctime=1389733361.878916447 Biblio-SICI-0.04/Makefile.PL0000644000175100001440000000222312265322761015660 0ustar00develusers00000000000000 use strict; use warnings; use 5.010001; use ExtUtils::MakeMaker 6.30; my %WriteMakefileArgs = ( "ABSTRACT" => "Provides methods for assembling, parsing, manipulating and serialising SICIs", "AUTHOR" => "Heiko Jansen ", "BUILD_REQUIRES" => {}, "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => "6.30" }, "DISTNAME" => "Biblio-SICI", "EXE_FILES" => [], "LICENSE" => "perl", "NAME" => "Biblio::SICI", "PREREQ_PM" => { "Business::ISSN" => 0, "Moo" => 0, "Text::Undiacritic" => 0, "Text::Unidecode" => 0, "Try::Tiny" => 0 }, "TEST_REQUIRES" => {}, "VERSION" => "0.04", "test" => { "TESTS" => "t/*.t" } ); my %FallbackPrereqs = ( "Business::ISSN" => 0, "Moo" => 0, "Text::Undiacritic" => 0, "Text::Unidecode" => 0, "Try::Tiny" => 0 ); unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) { delete $WriteMakefileArgs{TEST_REQUIRES}; delete $WriteMakefileArgs{BUILD_REQUIRES}; $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs; } delete $WriteMakefileArgs{CONFIGURE_REQUIRES} unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; WriteMakefile(%WriteMakefileArgs); Biblio-SICI-0.04/PaxHeaders.16263/t0000644000175100001440000000013212265322761014603 xustar000000000000000030 mtime=1389733361.880916468 30 atime=1389733361.878916447 30 ctime=1389733361.880916468 Biblio-SICI-0.04/t/0000755000175100001440000000000012265322761014152 5ustar00develusers00000000000000Biblio-SICI-0.04/t/PaxHeaders.16263/002_util.t0000644000175100001440000000013212265322761016403 xustar000000000000000030 mtime=1389733361.878916447 30 atime=1389733361.878916447 30 ctime=1389733361.878916447 Biblio-SICI-0.04/t/002_util.t0000644000175100001440000000240112265322761015672 0ustar00develusers00000000000000 use strict; use warnings; use Test::More; use Biblio::SICI::Util qw( calculate_check_char titleCode_from_title ); my $i = 0; $i = 1; foreach ( [ '0066-4200(1990)25<>1.0.TX;2-S', 'S' ], [ '0095-4403(199502/03)21:3<>1.0.TX;2-Z', 'Z' ], [ '1234-5679(1996)<::INS-023456>3.0.CO;2-#', '#' ], [ '0361-526X(2011)17:3/4<60-61:AAAAAA>2.0.ZU;2-', '0' ], ) { my $cc = calculate_check_char( $_->[0] ); is( $cc, $_->[1], 'calculate check char (subtest ' . $i++ . ')' ); } $i = 1; foreach ( [ 'Information Age Avatars', 'IAA' ], [ 'The Integrity of Digital Information; Mechanics and Definitional Issues', 'TIODIM' ], [ 'Quality: Theory and Practice', 'QTAP' ], [ 'A.D.A.M: The Inside Story', 'ATIS' ], [ 'ABC FlowCharter 4.0 Charts New Territory', 'AF4CNT' ], [ 'Library Programs Face $34.7 Million in Rescissions', 'LPF$MI' ], [ 'Boyz II Men, Adam jockeys for no. 1', 'BIMAJF' ], ) { my $tc = titleCode_from_title( $_->[0] ); is( $tc, $_->[1], 'derive correct title code (subtest ' . $i++ . ')' ); } done_testing(); Biblio-SICI-0.04/t/PaxHeaders.16263/003_parse.t0000644000175100001440000000013212265322761016541 xustar000000000000000030 mtime=1389733361.878916447 30 atime=1389733361.878916447 30 ctime=1389733361.878916447 Biblio-SICI-0.04/t/003_parse.t0000644000175100001440000000661112265322761016037 0ustar00develusers00000000000000 use strict; use warnings; use Test::More; use Data::Dumper; use Biblio::SICI; my $sici = Biblio::SICI->new(); isa_ok( $sici, 'Biblio::SICI', 'object instantiated' ); foreach ( ' 1234-5679(1996)<::INS-023456>3.0.CO;2-#', '0015-6914(19960101)157:1<>1.0.TX;2-V ', ' 0015-6914 ( 19960101 ) 157:1 < 62:KTSW > 2.0.TX ; 2-F ', '1064-3923(199505)6:5<>1.0.TX;2-U', '1064-3923(199505)6:5<26:MTW>2.0.TX;2-2', '0277-786X()364<123:COIPDA>2.0.TX;2-S', '0018-9219(1985)73*<>1.0.TX;2-6', '0066-4200(1990)25<>1.0.TX;2-S', '0066-4200(1990)25<263:IATIR>2.0.TX;2-A', '0095-4403(199312/199401)20:2<>1.0.TX;2-U', '0363-0277(19950315)120:5<>1.0.TX;2-V', '0363-0277(19950315)120:5<32:IAA>2.0.TX;2-0', '0002-8231(199602)47:2<173:POPR:CCC-020173-04>3.0.TX;2-E', '0002-8231(199412)45:10<>1.0.TX;2-P', '0002-8231(199412)45:10<>1.1.TX;2-M', '0002-8231(199412)45:10<>1.2.TX;2-J', '0002-8231(199412)45:10<737:TIODIM>2.3.TX;2-M', '0147-2593(199606)20:1<>1.0.TX;2-5', '0160-6506(194507)176:1<>1.0.HD;2-F', '0737-8831(1992)10:4<7:OAFFPC>2.0.TX;2-K', '0278-7687(1996)12<>1.0.CO;2-J', '0163-5808(199206)21:2<>1.0.TX;2-Z', '1055-2685(19950418)21:8<>1.0.TX;2-P', '1071-5800(199621)4<>1.0.CO;2-T', '1070-9916(199433)1:3<>1.0.TX;2-I', '0002-9769(199606/07)27:6<>1.0.TX;2-1', '0916-6564(199503)55<>1.0.TX;2-G', '1048-6542(1996)7:4<>1.0.CO;2-W', '0730-2312(199512)131:6:2<>1.0.TX;2-K', '0024-2160(199412)6:16:4<>1.0.TX;2-T', '0926-5473(1992)A:7<>1.0.TX;2-7', '0913-5707(199403)J77A:3<>1.0.TX;2-6', '0361-526X(199021/22)17:3/4<>1.0.TX;2-P', '1055-2685(19950623)21:13<>1.0.TX;2-I', '0095-5892(198408)21:8+<1:CD>2.0.TX;2-O', '0093-7673(19950910)+<>1.0.TX;2-R', '0015-6914(19950605)+<27:AMMIH>2.0.TX;2-I', '0031-9015(1985)43:13<>1.0.TX;2-M', '0095-4403(199502/03)21:3<>1.0.TX;2-Z', '1068-5723(19930729)1:5<>1.0.CO;2-6', '0730-9295(199206)11:2<168:CRFAOC>2.0.TX;2-#', '1064-6965(19950403)12:132.0.CO;2-7', '0048-4474(199623)<:F>2.0.CO;2-T', '0036-8075(19950224)267<1186:AT3AAL>2.0.TX;2-W', '8756-2324(198603/04)65:2<4:QTAP>2.0.TX;2-I', '0003-9632(198307/09)46:3+<1:LPLMSL>2.0.TX;2-I', '0741-8647(199503)12:3<81:ATIS>2.0.TX;2-G', '1069-7799(19950223)4:14<1:LPF$MI>2.0.CO;2-Q', '0163-8610(199006)19<6:IITCD>2.0.TX;2-L', '0149-4953(199504)24:4<118:T$BTC>2.0.TX;2-J', '0010-2571(1934/1935)7<307:DFDDD=>2.0.TX;2-P', '0006-2510(19950506)107:18<94:BIMAJF>2.0.TX;2-F', '0015-6914(19960101)157:12.0.TX;2-L', '0002-8231(199412)45:10<>1.2.TX;2-J', '0165-3806(1996)<::PII-S1065-3806(96)000403-8>3.0.TX;2-6', '0737-8831(1993)11:1<94:MEMAWT:ERIC-EJ462869>3.0.TX;2-8', '0361-526X(199021/22)17:3/4<187:TSAATI>2.0.TX;2-G', '0095-4403(199502/03)21:3<12:WATIIB>2.0.TX;2-J', #'1080-6563(199606)20:1<>1.0.CO;2-O', # ? #'0096-736X(1990)*<>1.0.HE;2-3', # wrong check char? #'0899-1847(199503)13:3<18:AF4CNT>2.0.TX;2-7', # wrong check char? #'0015-6914(19960101)157:12.2.TX;2-R', # wrong check char? #'0002-8231(199412)45:10<760:AEPMFA:CCC-0002-8231/94/10,00760-05>3.0.TX;2-D', # wrong check char? ) { my ( $valid, $roundTrip, $parserProblems ) = $sici->parse($_); is( $valid, 1, "parse valid SICI; '$_'; parser problems: " . join( '; ', @{$parserProblems} ) . "; validity problems: " . Dumper( { $sici->list_problems() } ) ); is( $roundTrip, 1, "successful round-trip; in: '$_', out: '" . $sici->to_string() . "'" ); $sici->reset; } ## end foreach ( '1234-5679(1996)<::INS-023456>3.0.CO;2-#'...) done_testing(); Biblio-SICI-0.04/t/PaxHeaders.16263/001_compile.t0000644000175100001440000000013212265322761017055 xustar000000000000000030 mtime=1389733361.879916458 30 atime=1389733361.879916458 30 ctime=1389733361.879916458 Biblio-SICI-0.04/t/001_compile.t0000644000175100001440000000042612265322761016351 0ustar00develusers00000000000000use strict; use warnings; use Test::More; use File::Find; my @files = (); sub wanted { push( @files, $File::Find::name ) if /\.pm\Z/; } find( \&wanted, ("lib") ); plan tests => scalar @files; for (@files) { s/^.*\blib\b.//; s/.pm$//; s{[\\/]}{::}g; require_ok($_); } Biblio-SICI-0.04/t/PaxHeaders.16263/004_assemble_basic.t0000644000175100001440000000013212265322761020364 xustar000000000000000030 mtime=1389733361.879916458 30 atime=1389733361.879916458 30 ctime=1389733361.879916458 Biblio-SICI-0.04/t/004_assemble_basic.t0000644000175100001440000000346312265322761017664 0ustar00develusers00000000000000 use strict; use warnings; use Test::More; use Data::Dumper; use Biblio::SICI; # 1064-3923(199505)6:5<>1.0.TX;2-U my $t1 = '1064-3923(199505)6:5<>1.0.TX;2-U'; my $s1 = Biblio::SICI->new(); isa_ok( $s1, 'Biblio::SICI', 'object instantiated' ); $s1->item->issn('1064-3923'); $s1->item->chronology('199505'); $s1->item->volume(6); $s1->item->issue(5); $s1->control->mfi('TX'); is( $s1->to_string, $t1, 'assemble simple SICI without contribution segment; using defaults for control segment' ); is_deeply( { $s1->list_problems() }, {}, "no problems for valid data" ); # Resets volume and issue $s1->item->enumeration('6:5'); is( $s1->to_string, $t1, 'enumeration replaces volume/issue' ); is_deeply( { $s1->list_problems() }, {}, "no problems for valid data" ); $s1->contribution->location('26'); $s1->contribution->titleCode('MTW'); my $t2 = '1064-3923(199505)6:5<26:MTW>2.0.TX;2-2'; is( $s1->to_string, $t2, 'add contribution info; automatically get new csi' ); is_deeply( { $s1->list_problems() }, {}, "no problems for valid data" ); $s1->contribution->reset; is( $s1->to_string, $t1, 'reset contribution info; automatically get previous csi again' ); is_deeply( { $s1->list_problems() }, {}, "no problems for valid data" ); $s1->control->reset; my $t3 = '1064-3923(199505)6:5<>1.0.ZU;2-F'; is( $s1->to_string, $t3, 'reset control info and get default mfi code (i.e. "unknown")' ); is_deeply( { $s1->list_problems() }, {}, "no problems for valid data" ); # 0018-9219(1985)73*<>1.0.TX;2-6 # 0095-4403(199312/199401)20:2<>1.0.TX;2-U # 0002-8231(199602)47:2<173:POPR:CCC-020173-04>3.0.TX;2-E # 1070-9916(199433)1:3<>1.0.TX;2-I # 0361-526X(199021/22)17:3/4<>1.0.TX;2-P # 0015-6914(19950605)+<27:AMMIH>2.0.TX;2-I # 0003-9632(198307/09)46:3+<1:LPLMSL>2.0.TX;2-I # 0165-3806(1996)<::PII-S1065-3806(96)000403-8>3.0.TX;2-6 done_testing(); Biblio-SICI-0.04/t/PaxHeaders.16263/release-pod-syntax.t0000644000175100001440000000013212265322761020571 xustar000000000000000030 mtime=1389733361.880916468 30 atime=1389733361.880916468 30 ctime=1389733361.880916468 Biblio-SICI-0.04/t/release-pod-syntax.t0000644000175100001440000000045012265322761020062 0ustar00develusers00000000000000#!perl BEGIN { unless ($ENV{RELEASE_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for release candidate testing'); } } use Test::More; eval "use Test::Pod 1.41"; plan skip_all => "Test::Pod 1.41 required for testing POD" if $@; all_pod_files_ok(); Biblio-SICI-0.04/PaxHeaders.16263/lib0000644000175100001440000000013212265322761015106 xustar000000000000000030 mtime=1389733361.879916458 30 atime=1389733361.879916458 30 ctime=1389733361.879916458 Biblio-SICI-0.04/lib/0000755000175100001440000000000012265322761014455 5ustar00develusers00000000000000Biblio-SICI-0.04/lib/PaxHeaders.16263/Biblio0000644000175100001440000000013212265322761016306 xustar000000000000000030 mtime=1389733361.880916468 30 atime=1389733361.879916458 30 ctime=1389733361.880916468 Biblio-SICI-0.04/lib/Biblio/0000755000175100001440000000000012265322761015655 5ustar00develusers00000000000000Biblio-SICI-0.04/lib/Biblio/PaxHeaders.16263/SICI.pm0000644000175100001440000000013212265322761017450 xustar000000000000000030 mtime=1389733361.879916458 30 atime=1389733361.879916458 30 ctime=1389733361.879916458 Biblio-SICI-0.04/lib/Biblio/SICI.pm0000644000175100001440000003427012265322761016750 0ustar00develusers00000000000000 package Biblio::SICI; { $Biblio::SICI::VERSION = '0.04'; } # ABSTRACT: Provides methods for assembling, parsing, manipulating and serialising SICIs use strict; use warnings; use 5.010001; use Moo; use Sub::Quote; use Biblio::SICI::ItemSegment; use Biblio::SICI::ContributionSegment; use Biblio::SICI::ControlSegment; use Biblio::SICI::Util qw( calculate_check_char ); has 'item' => ( is => 'ro', lazy => 1, isa => quote_sub(q{ die unless ( defined $_[0] and $_[0]->isa('Biblio::SICI::ItemSegment') ) }), builder => quote_sub(q{ my ($self) = @_; return Biblio::SICI::ItemSegment->new( _sici => $self ); }), init_arg => undef, ); has 'contribution' => ( is => 'ro', lazy => 1, isa => quote_sub( q{ die unless ( defined $_[0] and $_[0]->isa('Biblio::SICI::ContributionSegment') ) }), builder => quote_sub( q{ my ($self) = @_; return Biblio::SICI::ContributionSegment->new( _sici => $self ); }), init_arg => undef, ); has 'control' => ( is => 'ro', lazy => 1, isa => quote_sub( q{ my ($val) = @_; die unless ( defined $val and $val->isa('Biblio::SICI::ControlSegment') ) } ), builder => quote_sub( q{ my ($self) = @_; return Biblio::SICI::ControlSegment->new( _sici => $self ); }), init_arg => undef, ); has 'mode' => ( is => 'rw', isa => quote_sub(q{ my ($val) = @_; die unless ( $val eq 'strict' or $val eq 'lax' ) }), required => 1, coerce => sub { my ($val) = @_; $val = join( '', split( " ", lc($val) ) ); return $val if ( $val eq 'strict' or $val eq 'lax' ); return 'lax'; }, default => quote_sub(q{ "lax" }), ); has 'parsedString' => ( is => 'rwp', init_arg => undef, ); sub parse { my ( $self, $string ) = @_; my $strictMode = $self->mode() eq 'strict' ? 1 : 0; if ( defined $string ) { $string =~ s/\r/ /go; $string =~ s/\n/ /go; $string = join( '', split( " ", $string ) ); } unless ($string) { $strictMode ? die 'no string to parse' : return ( undef, undef, ['no string to parse'] ); } $self->_set_parsedString($string); my $checkChar = ''; if ( $string =~ /;([0-9])(?:-.)?\Z/ ) { if ( "$1" ne "2" ) { $strictMode ? die 'unsupported SICI version' : return ( undef, undef, ['unsupported SICI version'] ); } else { $self->control()->version(2); if ( $string =~ s/;2-(.)\Z// ) { $checkChar = $1; } } } my $parserProblems = []; my @chars = split( //, $string ); my $tmp = ''; while ( exists( $chars[0] ) and $chars[0] !~ /[(<]/ ) { $tmp .= shift @chars; } if ( $tmp and exists( $chars[0] ) ) { if ( $chars[0] eq '(' ) { # warn 'ISSN candidate: ' . $tmp; $self->item()->issn($tmp); shift @chars; } elsif ( $chars[0] eq '<' ) { push @{$parserProblems}, "item information missing"; # warn 'Missing item info'; # warn 'Enumeration candidate: ' . $tmp; if ( $tmp =~ /\A([A-Z0-9\/]+):([A-Z0-9\/]+)(?::([+*]))?\Z/ ) { $self->item()->volume($1); $self->item()->issue($2); $self->item()->supplOrIdx($3) if $3; } elsif ($tmp) { $self->item()->enumeration($tmp); } shift @chars; goto CONTRIB; } else { $strictMode ? die 'unparsable string' : return ( undef, undef, ['unparsable string'] ); } } ## end if ( $tmp and exists( ...)) else { $strictMode ? die 'unparsable string' : return ( undef, undef, ['unparsable string'] ); } $tmp = ''; while ( exists( $chars[0] ) and $chars[0] ne ')' ) { $tmp .= shift @chars; } if ( $tmp and exists( $chars[0] ) and $chars[0] eq ')' ) { # warn 'Chronology candidate: ' . $tmp; $self->item()->chronology($tmp); shift @chars; } elsif ( exists( $chars[0] ) and $chars[0] eq ')' ) { shift @chars; } else { $strictMode ? die 'unparsable string' : return ( undef, undef, ['unparsable string'] ); } $tmp = ''; while ( exists( $chars[0] ) and $chars[0] ne '<' ) { $tmp .= shift @chars; } if ( $tmp and exists( $chars[0] ) and $chars[0] eq '<' ) { # warn 'Enumeration candidate: ' . $tmp; if ( $tmp =~ /\A([A-Z0-9\/]+):([A-Z0-9\/]+)(?::([+*]))?\Z/ ) { $self->item()->volume($1); $self->item()->issue($2); $self->item()->supplOrIdx($3) if $3; } elsif ($tmp) { $self->item()->enumeration($tmp); } shift @chars; } elsif ( exists( $chars[0] ) and $chars[0] eq '<' ) { shift @chars; } else { $strictMode ? die 'unparsable string' : return ( undef, undef, ['unparsable string'] ); } CONTRIB: $tmp = ''; while ( exists( $chars[0] ) and $chars[0] ne '>' ) { $tmp .= shift @chars; } if ( $tmp and exists( $chars[0] ) and $chars[0] eq '>' ) { # warn 'Contribution candidate: ' . $tmp; if ( $tmp =~ /\A::(.+)\Z/ ) { $self->contribution()->localNumber($1); } elsif ( $tmp =~ /\A:([^:]+)(?::(.+))?\Z/ ) { $self->contribution()->titleCode($1); $self->contribution()->localNumber($2) if $2; } elsif ( $tmp =~ /\A([^:]+):([^:]+)(?::(.+))?\Z/ ) { $self->contribution()->location($1); $self->contribution()->titleCode($2); $self->contribution()->localNumber($3) if $3; } else { $self->contribution()->location($tmp); } shift @chars; } elsif ( exists( $chars[0] ) and $chars[0] eq '>' ) { shift @chars; } else { $strictMode ? die 'unparsable string' : return ( undef, undef, ['unparsable string'] ); } my $csi = ''; if ( exists( $chars[0] ) ) { $csi = shift @chars; } if ( exists( $chars[0] ) and $chars[0] eq '.' ) { shift @chars; } elsif ( exists( $chars[0] ) ) { shift(@chars) while ( $chars[0] ne '.' ); } if ( exists( $chars[0] ) ) { $self->control()->dpi( shift @chars ); } if ( exists( $chars[0] ) and $chars[0] eq '.' ) { shift @chars; } elsif ( exists( $chars[0] ) ) { shift(@chars) while ( $chars[0] ne '.' ); } if ( exists( $chars[0] ) and exists( $chars[1] ) ) { $self->control()->mfi( join( '', splice( @chars, 0, 2 ) ) ); } my $isValid = $self->is_valid(); if ( $strictMode && !$isValid ) { die 'parsing failed: invalid SICI'; } if ( $checkChar ne $self->checkchar() ) { push @{$parserProblems}, "wrong check char; was '$checkChar', should have been '$1'"; } if ( $checkChar !~ /\A[0-9A-Z#]\Z/ ) { push @{$parserProblems}, 'invalid original check char'; } if ( $self->control()->csi() ne $csi ) { push @{$parserProblems}, 'wrong csi in string input'; } my $roundTrip = ( $self->parsedString() eq $self->to_string() ? 1 : 0 ); return ( $isValid, $roundTrip, $parserProblems ); } ## end sub parse sub to_string { my $self = shift; my $str = $self->_to_string(); my $cs = calculate_check_char($str); return $str . $cs; } sub _to_string { my $self = shift; my $item = $self->item()->to_string(); my $contrib = $self->contribution()->to_string(); my $control = $self->control()->to_string(); return sprintf( '%s<%s>%s-', $item, $contrib, $control ); } sub checkchar { my $self = shift; my $siciAsString = $self->_to_string(); return calculate_check_char($siciAsString); } sub reset { my $self = shift; $self->item()->reset(); $self->contribution()->reset(); $self->control()->reset(); return; } sub is_valid { my $self = shift; my $itemIsValid = $self->item()->is_valid(); my $contribIsValid = $self->contribution()->is_valid(); my $controlIsValid = $self->control()->is_valid(); if ( $itemIsValid && $contribIsValid && $controlIsValid ) { return 1; } return 0; } sub list_problems { my $self = shift; my $hasProblems = 0; my %problems = (); if ( not $self->item()->is_valid() ) { $hasProblems++; $problems{'item'} = { $self->item()->list_problems() }; } if ( not $self->contribution()->is_valid() ) { $hasProblems++; $problems{'contribution'} = { $self->contribution()->list_problems() }; } if ( not $self->control()->is_valid() ) { $hasProblems++; $problems{'control'} = { $self->control()->list_problems() }; } if ($hasProblems) { return %problems; } return; } 1; __END__ =pod =encoding utf-8 =head1 NAME Biblio::SICI - Provides methods for assembling, parsing, manipulating and serialising SICIs =head1 VERSION version 0.04 =head1 SYNOPSIS use Biblio::SICI; my $sici = Biblio::SICI->new()->parse($someSICI); # or my $sici2 = Biblio::SICI->new(); $sici2->item->issn('0361-526X'); # ... setting more data attributes ... if ( $sici2->is_valid ) { say $sici->to_string; } =head1 DESCRIPTION A "Serial Item and Contribution Identifier" (SICI) is a code (ANSI/NISO standard Z39.56) used to uniquely identify specific volumes, articles or other identifiable parts of a periodical. This module provides methods for assembling, parsing, manipulating and serialising SICIs. Both internal implementation and public API are currently considered BETA and may change without warning in a future release. For more information on this have a look at the L below. =head1 WARNING This software is currently considered BETA. Things should work as intended and documented but if you use it you should test your own software extensively after any update to a new release of Biblio::SICI since both API and behaviour might have changed. =head1 CONFIGURATION You may specify the following option when instantiating a SICI object (i.e., when calling the "new()" constructor): =over 4 =item C Can be either C or C. C mode means that any operation that gets called with an invalid (according to the standard) value for an attribute will C. C mode means that any value is accepted and that you can use the C and C methods to analyze the object state. =back =head1 ATTRIBUTES =over 4 =item C An instance of L; this segment contains information about the serial item itself. =item C An instance of L; this segment contains information about an individual contribution to the whole item, e.g. an article in a journal issue. =item C An instance of L; this segment contains some meta-information about the thing described by the SICI and about the SICI itself. =item C Describes wether the object enforces strict conformance to the standard or not. Can be set to either C or C. This attribute is the only one that can be specified directly in the call of the constructor. Please keep in mind that changing the value does B mean that the attributes already present are re-checked! =item C Returns the original string that was passed to the C method or C if C was not called before. =back =head1 METHODS =over 4 =item C( STRING ) Tries to disassemble a string passed to it into the various components of a SICI. If I mode is enabled, it will C if either the string cannot be parsed or if no valid SICI can be derived from the string. If I mode is enabled, it returns a list of three values: The first value is C if parsing the string failed, or C<0> if the string could be parsed but the SICI is invalid, or C<1> if a valid SICI was found. The second value is also C if parsing the string failed, or C<0> if the string could be parsed but serializing the SICI does not result in the exact same string or C<1> if we get a full round-trip. The third value is a (possibly empty) array ref with a list of problems the parser detected. B these problems are distinct from those reported by the C method and can be retrieved again later. =item C Serializes the object to a string using the separator characters specified in the standard and returns it together with the check character appended. Does B verify if the resulting SICI is valid! =item STRING C() Stringifies the object first, then calculates (and returns) the checksum character. Does B check, if the stringified SICI is valid! =item C() Resets all attributes to their default values. Does not modify the C attribute. =item BOOL C() Determines if all of the attribute values stored in the object are valid and returns either a I or I value. B check if any required information is missing! =item HASHREF C() Returns either a hash of hashes of arrays containing the problems that were found when setting the various attributes of the SICI segments or C if there are no problems. The first hash level is indexed by the three SICI segments: I, I, and/or I. The level below is indexed by the attribute names (cf. the docs of the segment modules). For every attribute the third level contains an array reference with descriptive messages. { 'contribution' => { 'titleCode' => [ 'contains more than 6 characters', ], }, }; B check for meta problems (e.g. missing attributes). =back =head1 TODO The parsing of SICI strings sort-of works but I need to find out more about how the code copes with real world SICIs (i.e. especially those that are slightly malformed or invalid). It would probably make for a better programming style if I were using real type specifications for the attributes. On the other hand doing so would make the module employ overly strict checks when dealing with imperfect SICIs. Since type checks in Moo (or Moose) know nothing about the object, the only other solution I can think of would be using objects of type C act as frontend for instances of either I or I. This would require two separate sets of type definitions and make everything more complicated - and I am not sure if would provide us with a better way to handle and report formal problems. That said, I´m also not particularly happy with how C works right now and I´d be grateful for any suggestions for improvements (or for positive feedback if it works for you). Also for now only problems with the available data are detected while missing or inconsistend data is not checked for. And of course we need a more comprehensive test suite. =head1 SEE ALSO L =head1 AUTHOR Heiko Jansen =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2014 by Heiko Jansen. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Biblio-SICI-0.04/lib/Biblio/PaxHeaders.16263/SICI0000644000175100001440000000013212265322761017035 xustar000000000000000030 mtime=1389733361.881916478 30 atime=1389733361.880916468 30 ctime=1389733361.881916478 Biblio-SICI-0.04/lib/Biblio/SICI/0000755000175100001440000000000012265322761016404 5ustar00develusers00000000000000Biblio-SICI-0.04/lib/Biblio/SICI/PaxHeaders.16263/Util.pm0000644000175100001440000000013212265322761020365 xustar000000000000000030 mtime=1389733361.880916468 30 atime=1389733361.880916468 30 ctime=1389733361.880916468 Biblio-SICI-0.04/lib/Biblio/SICI/Util.pm0000644000175100001440000001077012265322761017664 0ustar00develusers00000000000000 package Biblio::SICI::Util; { $Biblio::SICI::Util::VERSION = '0.04'; } # ABSTRACT: Utility functions use strict; use warnings; use 5.010001; BEGIN { $Biblio::SICI::Util::TITLE_CODE = qr/[0-9A-Z&´*\\\{\}\(\)\[\],\@\$=!#%.+?";\/^\`~_|-]/; } use Exporter 'import'; our @EXPORT_OK = qw( calculate_check_char titleCode_from_title ); use Try::Tiny; sub titleCode_from_title { my $title = shift; die "Expected title string as parameter" unless defined($title) and $title; my $code = ''; try { require Text::Unidecode; } catch { warn __PACKAGE__ . "::titleCode_from_title() - unable to load 'Text::Unidecode': " . $_; }; try { require Text::Undiacritic; } catch { warn __PACKAGE__ . "::titleCode_from_title() - unable to load 'Text::Undiacritic': " . $_; }; my @words = split( /\s+/, $title ); my @chars = (); foreach my $word (@words) { my $firstChar = uc( substr( $word, 0, 1 ) ); if ( $firstChar =~ $Biblio::SICI::Util::TITLE_CODE ) { push @chars, $firstChar; } else { try { $word = Text::Unidecode::unidecode($word); }; try { $word = Text::Undiacritic::undiacritic($word); }; $firstChar = uc( substr( $word, 0, 1 ) ); if ( $firstChar =~ $Biblio::SICI::Util::TITLE_CODE ) { push @chars, $firstChar; } } } if ( @chars >= 1 ) { $code = join( "", splice( @chars, 0, 6 ) ); return $code; } return; } ## end sub titleCode_from_title sub calculate_check_char { my $str = shift; return unless defined($str) and $str; state $charValues = { 0 => 0, 1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, A => 10, B => 11, C => 12, D => 13, E => 14, F => 15, G => 16, H => 17, I => 18, J => 19, K => 20, L => 21, M => 22, N => 23, O => 24, P => 25, Q => 26, R => 27, S => 28, T => 29, U => 30, V => 31, W => 32, X => 33, Y => 34, Z => 35, '#' => 36 }; state $valueToChar = { reverse %{$charValues} }; $str =~ s/\-[0-9A-Z#]\Z/-/o; # remove check char if present my @chars = split( //, $str ); my @mapped = (); my $i = 0; foreach my $c (@chars) { if ( exists $charValues->{$c} ) { $mapped[$i] = $charValues->{$c}; } else { $mapped[$i] = 36; } $i++; } my $sum = 0; for ( my $j = $#mapped; $j >= 0; $j -= 2 ) { $sum += $mapped[$j]; } $sum *= 3; for ( my $j = $#mapped - 1; $j >= 0; $j -= 2 ) { $sum += $mapped[$j]; } my $mod = $sum % 37; # if remainder == 0; then 0 is the check char return '0' if $mod == 0; my $checkVal = 37 - $mod; my $checkChar = $valueToChar->{$checkVal}; return $checkChar; } ## end sub calculate_check_char 1; __END__ =pod =encoding utf-8 =head1 NAME Biblio::SICI::Util - Utility functions =head1 VERSION version 0.04 =head1 SYNOPSIS use Biblio::Sici; use Biblio::SICI::Util qw( titleCode_from_title calculate_check_char ); my $sici = Biblio::Sici->new(); ... if ( my $code = titleCode_from_title($title) ) { $sici->contribution->titleCode($code); } =head1 DESCRIPTION This module provides some utility functions which are useful when working with SICI. None of them are exported by default. =head1 FUNCTIONS =over 4 =item STRING C( STRING ) Tries to derive the C (cf. the contribution segment) from a string (i.e.: the title of the contribution) passed to it. Since the rules for the construction of the C are quite complex, this method probably won´t generate the correct code if the title contains elements other than regular english words (like mathematical or chemical symbols or characters from a non-ascii alphabet). If the method is able to generate a code it will be returned. Otherwise the return value is C. In order to have a better chance of generating a standard-conformant code the modules L and L are Cd. If they cannot be found, warnings are emitted but a code might nonetheless be generated. However, if the title is in a language other than english, the probability of generating the correct code sinks even more. =item STRING C( STRING ) Calculates and returns the check character. Does B check, if the string param is a valid SICI! A check character already present in the passed-in SICI will simply be ignored. =back =head1 AUTHOR Heiko Jansen =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2014 by Heiko Jansen. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Biblio-SICI-0.04/lib/Biblio/SICI/PaxHeaders.16263/ItemSegment.pm0000644000175100001440000000013212265322761021671 xustar000000000000000030 mtime=1389733361.880916468 30 atime=1389733361.880916468 30 ctime=1389733361.880916468 Biblio-SICI-0.04/lib/Biblio/SICI/ItemSegment.pm0000644000175100001440000003637312265322761021177 0ustar00develusers00000000000000 package Biblio::SICI::ItemSegment; { $Biblio::SICI::ItemSegment::VERSION = '0.04'; } # ABSTRACT: The item segment of a SICI use strict; use warnings; use 5.010001; use Moo; use Sub::Quote; use Business::ISSN; use Biblio::SICI; with 'Biblio::SICI::Role::ValidSegment', 'Biblio::SICI::Role::RecursiveLink'; has 'issn' => ( is => 'rw', trigger => 1, predicate => 1, clearer => 1, ); sub _trigger_issn { my ( $self, $newVal ) = @_; my @problems = (); if ( $newVal !~ m!\A[0-9X-]+\Z! ) { push @problems, 'contains invalid characters'; } if ( $newVal !~ m!\A[0-9]{4}\-[0-9]{3}[0-9X]\Z! ) { push @problems, 'structural error'; } unless (@problems) { if ( my $is = Business::ISSN->new($newVal) ) { unless ( $is->is_valid ) { push @problems, 'invalid issn'; } } } if (@problems) { $self->log_problem_on( 'issn' => [@problems] ); } else { $self->clear_problem_on('issn'); } return; } ## end sub _trigger_issn has 'chronology' => ( is => 'rw', trigger => 1, predicate => 1, clearer => 1, ); sub _trigger_chronology { my ( $self, $newVal ) = @_; # TODO calendar schemes other than Gregorian may be used?! my @problems = (); # 1 YYYY # 2 YYYY/YYYY with second YYYY > first YYYY # 3 YYYYMM # 4 YYYYMM/MM with second MM > first MM # 5 YYYYMM/YYYYMM with second YYYY > first YYYY # 6 YYYYMMDD # 7 YYYYMMDD/DD with second DD > first DD # 8 YYYYMMDD/MMDD with second MM > first MM # 9 YYYYMMDD/YYYYMMDD with second YYYY > first YYYY my (%e) = (); if ( $newVal =~ /\A[0-9]{4}\Z/ ) { $e{'1Y'} = $newVal; } elsif ( $newVal =~ /\A([0-9]{4})\/([0-9]{4})\Z/ ) { $e{'1Y'} = $1; $e{'2Y'} = $2; unless ( $e{'2Y'} > $e{'1Y'} ) { push @problems, 'if specified, second year must be larger than first year'; } } elsif ( $newVal =~ /\A([0-9]{4})([0-9]{2})\Z/ ) { $e{'1Y'} = $1; $e{'1M'} = $2; } elsif ( $newVal =~ /\A([0-9]{4})([0-9]{2})\/([0-9]{2})\Z/ ) { $e{'1Y'} = $1; $e{'1M'} = $2; $e{'2M'} = $3; unless ( $e{'2M'} > $e{'1M'} ) { push @problems, 'if specified, second month must be larger than first month'; } } elsif ( $newVal =~ /\A([0-9]{4})([0-9]{2})\/([0-9]{4})([0-9]{2})\Z/ ) { $e{'1Y'} = $1; $e{'1M'} = $2; $e{'2Y'} = $3; $e{'2M'} = $4; unless ( $e{'2Y'} > $e{'1Y'} ) { push @problems, 'if specified, second year must be larger than first year'; } } elsif ( $newVal =~ /\A([0-9]{4})([0-9]{2})([0-9]{2})\Z/ ) { $e{'1Y'} = $1; $e{'1M'} = $2; $e{'1D'} = $3; } elsif ( $newVal =~ /\A([0-9]{4})([0-9]{2})([0-9]{2})\/([0-9]{2})\Z/ ) { $e{'1Y'} = $1; $e{'1M'} = $2; $e{'1D'} = $3; $e{'2D'} = $4; unless ( $e{'2D'} > $e{'1D'} ) { push @problems, 'if specified, second day must be larger than first day'; } } elsif ( $newVal =~ /\A([0-9]{4})([0-9]{2})([0-9]{2})\/([0-9]{2})([0-9]{2})\Z/ ) { $e{'1Y'} = $1; $e{'1M'} = $2; $e{'1D'} = $3; $e{'2M'} = $4; $e{'2D'} = $5; unless ( $e{'2M'} > $e{'1M'} ) { push @problems, 'if specified, second month must be larger than first month'; } } elsif ( $newVal =~ /\A([0-9]{4})([0-9]{2})([0-9]{2})\/([0-9]{4})([0-9]{2})([0-9]{2})\Z/ ) { $e{'1Y'} = $1; $e{'1M'} = $2; $e{'1D'} = $3; $e{'2Y'} = $4; $e{'2M'} = $5; $e{'2D'} = $6; unless ( $e{'2Y'} > $e{'1Y'} ) { push @problems, 'if specified, second year must be larger than first year'; } } else { $self->log_problem_on( 'chronology', ['illegal chronology structure'] ); return; } # lets accept pub dates up to one year in the future # (relative to the date when this code is executed!) my (@time) = localtime(time); my $yr = $time[5] + 1900; my ( undef, undef, $decade, $year ) = split( '', $yr ); if ( $year == 9 ) { $year = 0; $decade += 1; } else { $year += 1; } my $prevDecade = $decade - 1; for (qw( 2D 1D )) { if ( exists $e{$_} and $e{$_} !~ /\A(?:[012][0-9]|3[01])\Z/ ) { push @problems, 'illegal value for ' . ( $_ eq '2D' ? 'second' : 'first' ) . ' day: should be 01-31'; } } for (qw( 2M 1M )) { if ( exists $e{$_} and $e{$_} !~ /\A(?:0[0-9]|1[012]|[23][1-4])\Z/ ) { push @problems, 'illegal value for ' . ( $_ eq '2M' ? 'second' : 'first' ) . ' month: should be 00-12, or 21-24, or 31-34'; } } for (qw( 2Y 1Y )) { if ( exists $e{$_} and $e{$_} !~ /\A(?:1[0-9][0-9]{2}|20[0-$prevDecade][0-9]|20$decade[0-$year])\Z/o ) { push @problems, 'illegal value for ' . ( $_ eq '2Y' ? 'second' : 'first' ) . ' year'; } } if ( !@problems ) { $self->clear_problem_on('chronology'); } else { $self->log_problem_on( 'chronology', \@problems ); } return; } ## end sub _trigger_chronology has 'enumeration' => ( is => 'rw', predicate => 1, clearer => 1, trigger => 1, ); sub _trigger_enumeration { my ( $self, $newVal ) = @_; # clear partial values $self->clear_volume(); $self->clear_problem_on('volume'); $self->clear_issue(); $self->clear_problem_on('issue'); $self->clear_supplOrIdx(); $self->clear_problem_on('supplOrIdx'); if ( $newVal !~ /\A[0-9A-Z:]*[+*]?\Z/ ) { $self->log_problem_on( 'enumeration' => ['invalid characters used'] ); } return; } has 'volume' => ( is => 'rw', predicate => 1, clearer => 1, trigger => 1, ); sub _trigger_volume { my ( $self, $newVal ) = @_; # clear aggregate value $self->clear_enumeration(); $self->clear_problem_on('enumeration'); my @problems = (); if ( $newVal !~ m!\A[A-Z0-9/]+\Z! ) { push @problems, 'contains invalid characters'; } if ( $newVal !~ m!\A[A-Z0-9]+(?:/[A-Z0-9]+)?\Z! ) { push @problems, 'structural error'; } if (@problems) { $self->log_problem_on( 'volume' => [@problems] ); } else { $self->clear_problem_on('volume'); } return; } ## end sub _trigger_volume has 'issue' => ( is => 'rw', predicate => 1, clearer => 1, trigger => 1, ); sub _trigger_issue { my ( $self, $newVal ) = @_; # clear aggregate value $self->clear_enumeration(); $self->clear_problem_on('enumeration'); my @problems = (); if ( $newVal !~ m!\A[A-Z0-9/]+\Z! ) { push @problems, 'contains invalid characters'; } if ( $newVal !~ m!\A[A-Z0-9]+(?:/[A-Z0-9]+)?\Z! ) { push @problems, 'structural error'; } if (@problems) { $self->log_problem_on( 'issue' => [@problems] ); } else { $self->clear_problem_on('issue'); } return; } ## end sub _trigger_issue has 'supplOrIdx' => ( is => 'rw', predicate => 1, clearer => 1, trigger => 1, ); sub _trigger_supplOrIdx { my ( $self, $newVal ) = @_; # clear aggregate value $self->clear_enumeration(); $self->clear_problem_on('enumeration'); my @problems = (); if ( length $newVal != 1 ) { push @problems, 'too many characters (allowed: 1)'; } if ( $newVal ne '+' and $newVal ne '*' ) { push @problems, 'contains invalid characters'; } if (@problems) { $self->log_problem_on( 'supplOrIdx' => [@problems] ); } else { $self->clear_problem_on('supplOrIdx'); } return; } ## end sub _trigger_supplOrIdx sub year { my $self = shift; return unless $self->has_chronology(); my $c = $self->chronology; # 1 YYYY # 2 YYYY/YYYY with second YYYY > first YYYY # 3 YYYYMM # 4 YYYYMM/MM with second MM > first MM # 5 YYYYMM/YYYYMM with second YYYY > first YYYY # 6 YYYYMMDD # 7 YYYYMMDD/DD with second DD > first DD # 8 YYYYMMDD/MMDD with second MM > first MM # 9 YYYYMMDD/YYYYMMDD with second YYYY > first YYYY if ( $c =~ /\A[0-9]{4}\Z/ ) { return "$c"; } elsif ( $c =~ /\A([0-9]{4})\/([0-9]{4})\Z/ ) { return ( "$1", "$2" ); } elsif ( $c =~ /\A([0-9]{4})(?:[0-9]{2})\Z/ ) { return "$1"; } elsif ( $c =~ /\A([0-9]{4})(?:[0-9]{2})\/(?:[0-9]{2})\Z/ ) { return "$1"; } elsif ( $c =~ /\A([0-9]{4})(?:[0-9]{2})\/([0-9]{4})(?:[0-9]{2})\Z/ ) { return ( "$1", "$2" ); } elsif ( $c =~ /\A([0-9]{4})(?:[0-9]{2})(?:[0-9]{2})\Z/ ) { return "$1"; } elsif ( $c =~ /\A([0-9]{4})(?:[0-9]{2})(?:[0-9]{2})\/(?:[0-9]{2})\Z/ ) { return "$1"; } elsif ( $c =~ /\A([0-9]{4})(?:[0-9]{2})(?:[0-9]{2})\/(?:[0-9]{2})(?:[0-9]{2})\Z/ ) { return "$1"; } elsif ( $c =~ /\A([0-9]{4})(?:[0-9]{2})(?:[0-9]{2})\/([0-9]{4})(?:[0-9]{2})(?:[0-9]{2})\Z/ ) { return ( "$1", "$2" ); } return; } ## end sub year sub month { my $self = shift; return unless $self->has_chronology(); my $c = $self->chronology; # 3 YYYYMM # 4 YYYYMM/MM with second MM > first MM # 5 YYYYMM/YYYYMM with second YYYY > first YYYY # 6 YYYYMMDD # 7 YYYYMMDD/DD with second DD > first DD # 8 YYYYMMDD/MMDD with second MM > first MM # 9 YYYYMMDD/YYYYMMDD with second YYYY > first YYYY if ( $c =~ /\A(?:[0-9]{4})([0-9]{2})\Z/ ) { return "$1"; } elsif ( $c =~ /\A(?:[0-9]{4})([0-9]{2})\/([0-9]{2})\Z/ ) { return ( "$1", "$2" ); } elsif ( $c =~ /\A(?:[0-9]{4})([0-9]{2})\/(?:[0-9]{4})([0-9]{2})\Z/ ) { return ( "$1", "$2" ); } elsif ( $c =~ /\A(?:[0-9]{4})([0-9]{2})(?:[0-9]{2})\Z/ ) { return "$1"; } elsif ( $c =~ /\A(?:[0-9]{4})([0-9]{2})(?:[0-9]{2})\/(?:[0-9]{2})\Z/ ) { return "$1"; } elsif ( $c =~ /\A(?:[0-9]{4})([0-9]{2})(?:[0-9]{2})\/([0-9]{2})(?:[0-9]{2})\Z/ ) { return ( "$1", "$2" ); } elsif ( $c =~ /\A(?:[0-9]{4})([0-9]{2})(?:[0-9]{2})\/(?:[0-9]{4})([0-9]{2})(?:[0-9]{2})\Z/ ) { return ( "$1", "$2" ); } return; } ## end sub month sub day { my $self = shift; return unless $self->has_chronology(); my $c = $self->chronology; # 6 YYYYMMDD # 7 YYYYMMDD/DD with second DD > first DD # 8 YYYYMMDD/MMDD with second MM > first MM # 9 YYYYMMDD/YYYYMMDD with second YYYY > first YYYY if ( $c =~ /\A(?:[0-9]{4})(?:[0-9]{2})([0-9]{2})\Z/ ) { return "$1"; } elsif ( $c =~ /\A(?:[0-9]{4})(?:[0-9]{2})([0-9]{2})\/([0-9]{2})\Z/ ) { return ( "$1", "$2" ); } elsif ( $c =~ /\A(?:[0-9]{4})(?:[0-9]{2})([0-9]{2})\/(?:[0-9]{2})([0-9]{2})\Z/ ) { return ( "$1", "$2" ); } elsif ( $c =~ /\A(?:[0-9]{4})(?:[0-9]{2})([0-9]{2})\/(?:[0-9]{4})(?:[0-9]{2})([0-9]{2})\Z/ ) { return ( "$1", "$2" ); } return; } ## end sub day sub to_string { my $self = shift; my $str = ''; if ( $self->has_issn() ) { $str = $self->issn(); } if ( $self->has_chronology() ) { $str .= '(' . $self->chronology() . ')'; } else { $str .= '()'; } if ( $self->has_enumeration() ) { $str .= $self->enumeration(); } else { if ( $self->has_volume() ) { $str .= $self->volume(); if ( $self->has_issue() ) { $str .= ':' . $self->issue(); } } if ( $self->has_supplOrIdx() ) { $str .= $self->supplOrIdx(); } } return $str; } ## end sub to_string sub reset { my $self = shift; $self->clear_issn(); $self->clear_problem_on('issn'); $self->clear_chronology(); $self->clear_problem_on('chronology'); $self->clear_enumeration(); $self->clear_problem_on('enumeration'); $self->clear_volume(); $self->clear_problem_on('volumne'); $self->clear_issue(); $self->clear_problem_on('issue'); $self->clear_supplOrIdx(); $self->clear_problem_on('supplOrIdx'); return; } 1; __END__ =pod =encoding utf-8 =head1 NAME Biblio::SICI::ItemSegment - The item segment of a SICI =head1 VERSION version 0.04 =head1 SYNOPSIS my $sici = Biblio::SICI->new(); $sici->item->issn('2232-7651'); =head1 DESCRIPTION I You are expected to not directly instantiate objects of this class! The item segment of a SICI describes various aspects of the serial item referenced by the SICI. Unlike the contribution segment, which may be empty, the item segment is required! =head1 ATTRIBUTES For each attribute, clearer ("clear_") and predicate ("has_") methods are provided. =over 4 =item C The ISSN of the serial. =item C Identifies a specific date - usually the cover date - for an item of a serial title. Follows the format "YYYYMMDD" with only the applicable levels being used. For "MM", in addition to 01 to 12, the values 21 to 24 represent seasons (Spring, Summer, Fall, Winter) and the values 31 to 34 represent the four quarters of a year. =item C Describes, which item of the serial is referenced. The most common way of identifying an item is using a combination of volume and issue numbers, which is why there are separate attributes for these kinds of data. Please not that setting a value for C means that any value present in the attributes C, C or C gets removed! =item C The volume designation of the serial item. Please note that setting a value for this attribute automatically clears the C attribute. =item C The issue designation of the serial item. Please note that setting a value for this attribute automatically clears the C attribute. =item C A one character code to describe if the SICI refers to either a supplement of the described item (represented as '+') or to an index (represented as '*') which is published independently from a regular item. (If you whish to refer to an index within an item please have a look at the C attribute of the control segment!) Please note that setting a value for this attribute automatically clears the C attribute. =back =head1 METHODS =over 4 =item LIST C() Extracts the year info from the C attribute. Returns C if no chronology has been set. May return either one or two values, depending on the given chronology. E.g.: =over 4 =item if the chronology value is B<199624/199721> (an item published Winter 1996 / Spring 1997) this method will return C<(1996, 1997)> =item if the chronology value is B<20021201> (item published on Dec. 1st, 2002) this method will return C<(2002)> =back =item LIST C() Extracts the month(s) from the chronology. Returns C if no chronology has been set or no month info is available from the chronology. May return either one or two values, depending on the given chronology. Each value may be in the ranges 01 to 12, or 21 to 24, or 31 to 34; with 21 to 24 being the codes for the seasons Spring, Summer, Fall, and Winter and 31 to 34 being the codes for the four quarters of a year (cf. the info on the C attribute). E.g.: =over 4 =item if the chronology value is B<199911/12> (an item published November / December 1999) this method will return C<(11, 12)> =item if the chronology value is B<20021201> (item published on Dec. 1st, 2002) this method will return C<(12)> =item if the chronology value is B<200721/22> (an item published Spring / Summer 2007) this method will return C<(21, 22)> =back =item LIST C() Extracts the days(s) from the chronology. Returns C if no chronology has been set or no day info is available from the chronology. May return either one or two values, depending on the given chronology. E.g.: =over 4 =item if the chronology value is B<19991101/02> (an item published November 1st / November 2nd 1999) this method will return C<(01, 02)> (note the leading zeroes!); day spans are quite unlikely, but not prohibited =item if the chronology value is B<20021201> (item published on Dec. 1st, 2002) this method will return C<(01)> =back =item STRING C() Returns a stringified representation of the data in the item segment. =item C() Resets all attributes to their default values. =item BOOL C() Checks if the data for the control segment conforms to the standard. =back =head1 SEE ALSO L =head1 AUTHOR Heiko Jansen =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2014 by Heiko Jansen. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Biblio-SICI-0.04/lib/Biblio/SICI/PaxHeaders.16263/ControlSegment.pm0000644000175100001440000000013212265322761022413 xustar000000000000000030 mtime=1389733361.880916468 30 atime=1389733361.880916468 30 ctime=1389733361.880916468 Biblio-SICI-0.04/lib/Biblio/SICI/ControlSegment.pm0000644000175100001440000001213212265322761021704 0ustar00develusers00000000000000 package Biblio::SICI::ControlSegment; { $Biblio::SICI::ControlSegment::VERSION = '0.04'; } # ABSTRACT: The control segment of a SICI use strict; use warnings; use 5.010001; use Moo; use Sub::Quote; use Biblio::SICI; with 'Biblio::SICI::Role::ValidSegment', 'Biblio::SICI::Role::RecursiveLink'; has 'dpi' => ( is => 'rw', lazy => 1, trigger => 1, default => quote_sub(q{ 0 }), predicate => 1, clearer => 1, ); sub _trigger_dpi { my ( $self, $newVal ) = @_; if ( not( "$newVal" eq "0" or "$newVal" eq "1" or "$newVal" eq "2" or "$newVal" eq "3" ) ) { $self->log_problem_on( 'dpi' => ['value not in allowed range (0|1|2|3)'] ); } else { $self->clear_problem_on('dpi'); } return; } has 'mfi' => ( is => 'rw', lazy => 1, trigger => 1, default => quote_sub(q{ "ZU" }), predicate => 1, clearer => 1, ); sub _trigger_mfi { my ( $self, $newVal ) = @_; if ( $newVal !~ /\A(?:C[DFOT]|H[DE]|SC|T[BHLSX]|VX|Z[NUZ])\Z/ ) { $self->log_problem_on( 'mfi' => ['unknown identifier'] ); } else { $self->clear_problem_on('mfi'); } return; } has 'version' => ( is => 'rw', lazy => 1, trigger => 1, default => quote_sub(q{ 2 }), predicate => 1, clearer => 1, ); sub _trigger_version { my ( $self, $newVal ) = @_; if ( $newVal != 2 ) { $self->log_problem( 'version' => ['unsupported version number (i.e. not "2")'] ); } else { $self->clear_problem_on('version'); } return; } sub csi { my $self = shift; if ( $self->_sici()->contribution()->has_localNumber() ) { return 3; } if ( $self->_sici()->contribution()->has_location() or $self->_sici()->contribution()->has_titleCode() ) { return 2; } return 1; } sub to_string { my $self = shift; # Every attribute in this class has a default value return sprintf( '%s.%s.%s;%s', $self->csi(), $self->dpi(), $self->mfi(), $self->version() ); } sub reset { my $self = shift; $self->clear_dpi(); $self->clear_problem_on('dpi'); $self->clear_mfi(); $self->clear_problem_on('mfi'); $self->clear_version(); $self->clear_problem_on('version'); return; } 1; __END__ =pod =encoding utf-8 =head1 NAME Biblio::SICI::ControlSegment - The control segment of a SICI =head1 VERSION version 0.04 =head1 SYNOPSIS my $sici = Biblio::SICI->new(); $sici->control->csi(2); =head1 DESCRIPTION I You are expected to not directly instantiate objects of this class! The control segment of a SICI describes various aspects of the I referenced by the SICI using pre-defined codes. The segment also contains some meta-information about the SICI itself. =head1 ATTRIBUTES For each attribute, clearer ("clear_") and predicate ("has_") methods are provided. =over 4 =item C The I tells us, what kind of I is described by the SICI. It can take one of four different values: B<0> => SICI describes Serial Item or Contribution itself B<1> => SICI describes ToC of Serial Item or Contribution B<2> => SICI describes Index of Serial Item or Contribution B<3> => SICI describes Abstract of Serial Item or Contribution The default value is B<0>. =item C The I can take one of these codes: B => Computer-readable optical media (CD-ROM) B => Computer-readable magnetic disk media B => Online (remote) B => Computer-readable magnetic tape media B => Microfilm B => Microfiche B => Sound recording B => Braille B => Printed text, hardbound B => Printed text, looseleaf B => Printed text, softcover B => Printed text B => Video recording B => Multiple physical forms B => Physical form unknown B => Other physical form The default value is B. =item C The number of the standards version to which the SICI should adhere. The default is B<2> (which means Z39.56-1996), since that is also the only currently supported version. =back =head1 METHODS =over 4 =item C The I tells something about which parts of the SICI carry values. It can take one of three values: B<1> => SICI for Serial Item B<2> => SICI for Serial Contribution B<3> => SICI for Serial Contribution "with obscure numbering" This method automatically derives the correct value from the presence of the respective data elements in the item and contribution segments. If no data is present in the contribution segment the final default is B<1>. =item STRING C() Returns a stringified representation of the data in the control segment. Please note that the check digit is I considered to be a part of the control segment (but the "-" preceding it in the SICI string is). =item C() Resets all attributes to their default values. =item BOOL C() Checks if the data for the control segment conforms to the standard. =back =head1 SEE ALSO L =head1 AUTHOR Heiko Jansen =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2014 by Heiko Jansen. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Biblio-SICI-0.04/lib/Biblio/SICI/PaxHeaders.16263/Role0000644000175100001440000000013212265322761017736 xustar000000000000000030 mtime=1389733361.881916478 30 atime=1389733361.881916478 30 ctime=1389733361.881916478 Biblio-SICI-0.04/lib/Biblio/SICI/Role/0000755000175100001440000000000012265322761017305 5ustar00develusers00000000000000Biblio-SICI-0.04/lib/Biblio/SICI/Role/PaxHeaders.16263/ValidSegment.pm0000644000175100001440000000013212265322761022733 xustar000000000000000030 mtime=1389733361.881916478 30 atime=1389733361.881916478 30 ctime=1389733361.881916478 Biblio-SICI-0.04/lib/Biblio/SICI/Role/ValidSegment.pm0000644000175100001440000000461512265322761022233 0ustar00develusers00000000000000package Biblio::SICI::Role::ValidSegment; { $Biblio::SICI::Role::ValidSegment::VERSION = '0.04'; } # ABSTRACT: Role to provide common validation error handling functionality to the segments use strict; use warnings; use Moo::Role; has validationErrors => ( is => 'lazy', ); sub _build_validationErrors { return {}; } sub log_problem_on { my ( $self, $attr, $desc ) = @_; if ( defined($attr) and $attr and defined($desc) and $desc ) { $self->validationErrors->{$attr} = $desc; } return; } sub clear_problem_on { my ( $self, $attr ) = @_; delete $self->validationErrors->{$attr} if exists $self->validationErrors->{$attr}; return; } sub list_problems { my $self = shift; return %{ $self->validationErrors }; } sub is_valid { my $self = shift; my $invalid = 0; my %problems = %{ $self->validationErrors }; foreach my $attr ( keys %problems ) { if ( exists $problems{$attr} and defined $problems{$attr} and $problems{$attr} ne '' ) { $invalid++; } } return 0 if $invalid; return 1; } 1; __END__ =pod =encoding utf-8 =head1 NAME Biblio::SICI::Role::ValidSegment - Role to provide common validation error handling functionality to the segments =head1 VERSION version 0.04 =head1 DESCRIPTION A role that provides an attribute and some methods used for validation error handling functionality in the three SICI segments. =head1 ATTRIBUTES =over 4 =item validationErrors Stores the problem reports that are gathered when any attribute is set. Do not access this directly - use the methods below. =back =head1 METHODS =over 4 =item C( STRING, ARRAYREF ) Stores an array ref of problem descriptions for a particular attribute. =item C( STRING ) Removes the problem report for a particular attribute. =item HASH C() Returns a hash structure with all error reports. =item BOOL C() Checks if any problem reports were recorded for any attribute. If yes, returns I; otherwise, returns I. Does not yet do extended verification; e.g. checking if all required data is present or if there are any conflicts within the stored SICI data! =back =head1 AUTHOR Heiko Jansen =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2014 by Heiko Jansen. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Biblio-SICI-0.04/lib/Biblio/SICI/Role/PaxHeaders.16263/RecursiveLink.pm0000644000175100001440000000013212265322761023136 xustar000000000000000030 mtime=1389733361.881916478 30 atime=1389733361.881916478 30 ctime=1389733361.881916478 Biblio-SICI-0.04/lib/Biblio/SICI/Role/RecursiveLink.pm0000644000175100001440000000210612265322761022427 0ustar00develusers00000000000000package Biblio::SICI::Role::RecursiveLink; { $Biblio::SICI::Role::RecursiveLink::VERSION = '0.04'; } # ABSTRACT: Role to provide a "link" to the parent Biblio::SICI use strict; use warnings; use Moo::Role; use Sub::Quote; has '_sici' => ( is => 'ro', required => 1, isa => quote_sub(q{ my ($val) = @_; die unless ( $val->isa('Biblio::SICI') ) }), weak => 1, ); 1; __END__ =pod =encoding utf-8 =head1 NAME Biblio::SICI::Role::RecursiveLink - Role to provide a "link" to the parent Biblio::SICI =head1 VERSION version 0.04 =head1 DESCRIPTION A role that provides an attribute used to provide internal access to the parent C object from the three segment classes. B =head1 ATTRIBUTES =over 4 =item _sici Weak ref to the parent object. =back =head1 AUTHOR Heiko Jansen =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2014 by Heiko Jansen. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Biblio-SICI-0.04/lib/Biblio/SICI/PaxHeaders.16263/ContributionSegment.pm0000644000175100001440000000013212265322761023452 xustar000000000000000030 mtime=1389733361.881916478 30 atime=1389733361.881916478 30 ctime=1389733361.881916478 Biblio-SICI-0.04/lib/Biblio/SICI/ContributionSegment.pm0000644000175100001440000001002412265322761022741 0ustar00develusers00000000000000 package Biblio::SICI::ContributionSegment; { $Biblio::SICI::ContributionSegment::VERSION = '0.04'; } # ABSTRACT: The contribution segment of a SICI use strict; use warnings; use 5.010001; use Moo; use Sub::Quote; use Biblio::SICI; with 'Biblio::SICI::Role::ValidSegment', 'Biblio::SICI::Role::RecursiveLink'; use Biblio::SICI::Util (); has 'location' => ( is => 'rw', trigger => 1, predicate => 1, clearer => 1, ); sub _trigger_location { my ( $self, $newVal ) = @_; if ( $newVal !~ /\A${Biblio::SICI::Util::TITLE_CODE}+\Z/ ) { $self->log_problem_on( 'location' => ['contains invalid characters'] ); } else { $self->clear_problem_on('location'); } return; } has 'titleCode' => ( is => 'rw', trigger => 1, predicate => 1, clearer => 1, ); sub _trigger_titleCode { my ( $self, $newVal ) = @_; my @problems = (); if ( length $newVal > 6 ) { push @problems, 'contains more than 6 characters'; } if ( $newVal !~ /\A${Biblio::SICI::Util::TITLE_CODE}+\Z/ ) { push @problems, 'contains invalid characters'; } if (@problems) { $self->log_problem_on( titleCode => \@problems ); } else { $self->clear_problem_on('titleCode'); } return; } has 'localNumber' => ( is => 'rw', trigger => 1, predicate => 1, clearer => 1, ); sub _trigger_localNumber { my ( $self, $newVal ) = @_; if ( $newVal !~ /\A${Biblio::SICI::Util::TITLE_CODE}+\Z/ ) { $self->log_problem_on( 'location' => ['contains invalid characters'] ); } else { $self->clear_problem_on('location'); } return; } sub to_string { my $self = shift; my $str = ''; if ( $self->has_location() ) { $str .= $self->location(); } if ( $self->has_titleCode() ) { $str .= ':' . $self->titleCode(); } if ( $self->has_localNumber() ) { if ( $self->has_location() or $self->has_titleCode() ) { $str .= ':' . $self->localNumber(); } else { $str .= '::' . $self->localNumber(); } } return $str; } sub reset { my $self = shift; $self->clear_location(); $self->clear_problem_on('location'); $self->clear_titleCode(); $self->clear_problem_on('titleCode'); $self->clear_localNumber(); $self->clear_problem_on('localNumber'); return; } 1; __END__ =pod =encoding utf-8 =head1 NAME Biblio::SICI::ContributionSegment - The contribution segment of a SICI =head1 VERSION version 0.04 =head1 SYNOPSIS my $sici = Biblio::SICI->new(); $sici->contribution->location('6-21'); =head1 DESCRIPTION I You are expected to not directly instantiate objects of this class! The contribution segment of a SICI contains information about a contribution to an item, e.g. about an article published in a journal issue. A SICI can be valid without containing data on a contribution so this segment may be empty / unused. For further information please have a look at the standard. =head1 ATTRIBUTES For each attribute, clearer ("clear_") and predicate ("has_") methods are provided. =over 4 =item C The location of the contribution within the item. A typical example would be the range of pages an article was printed on. =item C A special code of no more than 6 characters, derived from the title of the contribution. Rules for the construction of the code are provided in the standard. =item C An opaque number that somehow describes the contribution in the context of its item. =back =head1 METHODS =over 4 =item STRING C() Returns a stringified representation of the data in the contribution segment. =item C() Resets all attributes to their default values. Resetting the contribution segment also resets the value of the C attribute in the control segment! =item BOOL C() Checks if the data for the contribution segment conforms to the standard. =back =head1 SEE ALSO L =head1 AUTHOR Heiko Jansen =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2014 by Heiko Jansen. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut