Biblio::SICI(3pm) | User Contributed Perl Documentation | Biblio::SICI(3pm) |
Biblio::SICI - Provides methods for assembling, parsing, manipulating and serialising SICIs
version 0.04
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; }
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 TODO section below.
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.
You may specify the following option when instantiating a SICI object (i.e., when calling the "new()" constructor):
"strict" mode means that any operation that gets called with an invalid (according to the standard) value for an attribute will "die()".
"lax" mode means that any value is accepted and that you can use the "is_valid()" and "list_problems()" methods to analyze the object state.
Please keep in mind that changing the value does not mean that the attributes already present are re-checked!
If strict mode is enabled, it will "die()" if either the string cannot be parsed or if no valid SICI can be derived from the string.
If lax mode is enabled, it returns a list of three values:
The first value is "undef" if parsing the string failed, or 0 if the string could be parsed but the SICI is invalid, or 1 if a valid SICI was found.
The second value is also "undef" if parsing the string failed, or 0 if the string could be parsed but serializing the SICI does not result in the exact same string or 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. Please note: these problems are distinct from those reported by the "list_problems" method and can be retrieved again later.
Does not verify if the resulting SICI is valid!
Does not modify the "mode" attribute.
TODO check if any required information is missing!
The first hash level is indexed by the three SICI segments: item, contribution, and/or control.
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', ], }, };
TODO check for meta problems (e.g. missing attributes).
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 "Biblio::SICI" act as frontend for instances of either Biblio::SICI::Strict or Biblio::SICI::Lax. 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 "list_problems()" 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.
<https://en.wikipedia.org/wiki/Serial_Item_and_Contribution_Identifier>
Heiko Jansen <hjansen@cpan.org>
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.
2023-02-06 | perl v5.36.0 |