MARC-Fast-0.12/0002755000175000017500000000000012205653021012723 5ustar dpavlindpavlinMARC-Fast-0.12/lib/0002755000175000017500000000000012205653021013471 5ustar dpavlindpavlinMARC-Fast-0.12/lib/MARC/0002755000175000017500000000000012205653021014213 5ustar dpavlindpavlinMARC-Fast-0.12/lib/MARC/Fast.pm0000644000175000017500000002255312205652766015472 0ustar dpavlindpavlinpackage MARC::Fast; use strict; use Carp; use Data::Dump qw/dump/; BEGIN { use Exporter (); use vars qw ($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); $VERSION = 0.12; @ISA = qw (Exporter); #Give a hoot don't pollute, do not export more than needed by default @EXPORT = qw (); @EXPORT_OK = qw (); %EXPORT_TAGS = (); } =head1 NAME MARC::Fast - Very fast implementation of MARC database reader =head1 SYNOPSIS use MARC::Fast; my $marc = new MARC::Fast( marcdb => 'unimarc.iso', ); foreach my $mfn ( 1 .. $marc->count ) { print $marc->to_ascii( $mfn ); } For longer example with command line options look at L =head1 DESCRIPTION This is very fast alternative to C and C modules. It's is also very subtable for random access to MARC records (as opposed to sequential one). =head1 METHODS =head2 new Read MARC database my $marc = new MARC::Fast( marcdb => 'unimarc.iso', quiet => 0, debug => 0, assert => 0, hash_filter => sub { my ($t, $record_number) = @_; $t =~ s/foo/bar/; return $t; }, ); =cut ################################################## subroutine header end ## sub new { my $class = shift; my $self = {@_}; bless ($self, $class); croak "need marcdb parametar" unless ($self->{marcdb}); print STDERR "# opening ",$self->{marcdb},"\n" if ($self->{debug}); open($self->{fh}, $self->{marcdb}) || croak "can't open ",$self->{marcdb},": $!"; binmode($self->{fh}); $self->{count} = 0; while (! eof($self->{fh})) { $self->{count}++; # save record position push @{$self->{fh_offset}}, tell($self->{fh}); my $leader; my $len = read($self->{fh}, $leader, 24); if ($len < 24) { warn "short read of leader, aborting\n"; $self->{count}--; last; } # Byte Name # ---- ---- # 0-4 Record Length # 5 Status (n=new, c=corrected and d=deleted) # 6 Type of Record (a=printed material) # 7 Bibliographic Level (m=monograph) # 8-9 Blanks # 10 Indictator count (2 for monographs) # 11 Subfield code count (2 - 0x1F+subfield code itself) # 12-16 Base address of data # 17 Encoding level (blank=full level, 1=sublevel 1, 2=sublevel 2, # 3=sublevel 3) # 18 Descriptive Cataloguing Form (blank=record is full ISBD, # n=record is in non-ISBD format, i=record is in # an incomplete ISBD format) # 19 Blank # 20 Length of length field in directory (always 4 in UNIMARC) # 21 Length of Starting Character Position in directory (always # 5 in UNIMARC) # 22 Length of implementation defined portion in directory (always # 0 in UNIMARC) # 23 Blank # # |0 45 89 |12 16|1n 450 | # |xxxxxnam 22(.....) 45 <--- print STDERR "REC ",$self->{count},": $leader\n" if ($self->{debug}); # store leader for later push @{$self->{leader}}, $leader; # skip to next record my $o = substr($leader,0,5); warn "# in record ", $self->{count}," record length isn't number but: ",dump($o),"\n" unless $o =~ m/^\d+$/; if ($o > 24) { seek($self->{fh},$o-24,1) if ($o); } else { last; } } return $self; } =head2 count Return number of records in database print $marc->count; =cut sub count { my $self = shift; return $self->{count}; } =head2 fetch Fetch record from database my $hash = $marc->fetch(42); First record number is C<1> =cut sub fetch { my $self = shift; my $rec_nr = shift; if ( ! $rec_nr ) { $self->{last_leader} = undef; return; } my $leader = $self->{leader}->[$rec_nr - 1]; $self->{last_leader} = $leader; unless ($leader) { carp "can't find record $rec_nr"; return; }; my $offset = $self->{fh_offset}->[$rec_nr - 1]; unless (defined($offset)) { carp "can't find offset for record $rec_nr"; return; }; my $reclen = substr($leader,0,5); my $base_addr = substr($leader,12,5); print STDERR "# $rec_nr leader: '$leader' reclen: $reclen base addr: $base_addr [dir: ",$base_addr - 24,"]\n" if ($self->{debug}); my $skip = 0; print STDERR "# seeking to $offset + 24\n" if ($self->{debug}); if ( ! seek($self->{fh}, $offset+24, 0) ) { carp "can't seek to $offset: $!"; return; } print STDERR "# reading ",$base_addr-24," bytes of dictionary\n" if ($self->{debug}); my $directory; if( ! read($self->{fh},$directory,$base_addr-24) ) { carp "can't read directory: $!"; $skip = 1; } else { print STDERR "# $rec_nr directory: [",length($directory),"] '$directory'\n" if ($self->{debug}); } print STDERR "# reading ",$reclen-$base_addr," bytes of fields\n" if ($self->{debug}); my $fields; if( ! read($self->{fh},$fields,$reclen-$base_addr) ) { carp "can't read fields: $!"; $skip = 1; } else { print STDERR "# $rec_nr fields: '$fields'\n" if ($self->{debug}); } my $row; while (!$skip && $directory =~ s/(\d{3})(\d{4})(\d{5})//) { my ($tag,$len,$addr) = ($1,$2,$3); if (($addr+$len) > length($fields)) { print STDERR "WARNING: error in dictionary on record $rec_nr skipping...\n" if (! $self->{quiet}); $skip = 1; next; } # take field my $f = substr($fields,$addr,$len); print STDERR "tag/len/addr $tag [$len] $addr: '$f'\n" if ($self->{debug}); push @{ $row->{$tag} }, $f; my $del = substr($fields,$addr+$len-1,1); # check field delimiters... if ($self->{assert} && $del ne chr(30)) { print STDERR "WARNING: skipping record $rec_nr, can't find delimiter 30 got: '$del'\n" if (! $self->{quiet}); $skip = 1; next; } if ($self->{assert} && length($f) < 2) { print STDERR "WARNING: skipping field $tag from record $rec_nr because it's too short!\n" if (! $self->{quiet}); next; } } return $row; } =head2 last_leader Returns leader of last record Led print $marc->last_leader; Added in version 0.08 of this module, so if you need it use: use MARC::Fast 0.08; to be sure that it's supported. =cut sub last_leader { my $self = shift; return $self->{last_leader}; } =head2 to_hash Read record with specified MFN and convert it to hash my $hash = $marc->to_hash( $mfn, include_subfields => 1, hash_filter => sub { my ($l,$tag) = @_; return $l; } ); It has ability to convert characters (using C) from MARC database before creating structures enabling character re-mapping or quick fix-up of data. If you specified C both in C and C only the one from C will be used. This function returns hash which is like this: '200' => [ { 'i1' => '1', 'i2' => ' ' 'a' => 'Goa', 'f' => 'Valdo D\'Arienzo', 'e' => 'tipografie e tipografi nel XVI secolo', } ], This method will also create additional field C<000> with MFN. =cut sub to_hash { my $self = shift; my $mfn = shift || confess "need mfn!"; my $args = {@_}; my $filter_coderef = $args->{'hash_filter'} || $self->{'hash_filter'}; # init record to include MFN as field 000 my $rec = { '000' => [ $mfn ] }; my $row = $self->fetch($mfn) || return; foreach my $tag (keys %{$row}) { foreach my $l (@{$row->{$tag}}) { # remove end marker $l =~ s/\x1E$//; # filter output $l = $filter_coderef->($l, $tag) if $filter_coderef; my $val; # has identifiers? ($val->{'i1'},$val->{'i2'}) = ($1,$2) if ($l =~ s/^([01 #])([01 #])\x1F/\x1F/); my $sf_usage; my @subfields; # has subfields? if ($l =~ m/\x1F/) { foreach my $t (split(/\x1F/,$l)) { next if (! $t); my $f = substr($t,0,1); my $v = substr($t,1); push @subfields, ( $f, $sf_usage->{$f}++ || 0 ); # repeatable subfiled -- convert it to array if ( defined $val->{$f} ) { if ( ref($val->{$f}) ne 'ARRAY' ) { $val->{$f} = [ $val->{$f}, $v ]; } else { push @{$val->{$f}}, $v; } } else { $val->{$f} = $v; } } $val->{subfields} = [ @subfields ] if $args->{include_subfields}; } else { $val = $l; } push @{$rec->{$tag}}, $val; } } return $rec; } =head2 to_ascii print $marc->to_ascii( 42 ); =cut sub to_ascii { my $self = shift; my $mfn = shift || confess "need mfn"; my $row = $self->fetch($mfn) || return; my $out; foreach my $f (sort keys %{$row}) { my $dump = join('', @{ $row->{$f} }); $dump =~ s/\x1e$//; $dump =~ s/\x1f/\$/g; $out .= "$f\t$dump\n"; } return $out; } 1; __END__ =head1 UTF-8 ENCODING This module does nothing with encoding. But, since MARC format is byte oriented even when using UTF-8 which has variable number of bytes for each character, file is opened in binary mode. As a result, all scalars recturned to perl don't have utf-8 flag. Solution is to use C and L to decode utf-8 encoding like this: use Encode; my $marc = new MARC::Fast( marcdb => 'utf8.marc', hash_filter => sub { Encode::decode( 'utf-8', $_[0] ); }, ); This will affect C, but C will still return binary representation since it doesn't support C. =head1 AUTHOR Dobrica Pavlinusic CPAN ID: DPAVLIN dpavlin@rot13.org http://www.rot13.org/~dpavlin/ =head1 COPYRIGHT This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this module. =head1 SEE ALSO L, perl(1). =cut MARC-Fast-0.12/LICENSE0000644000175000017500000005010112205652766013742 0ustar dpavlindpavlinTerms of Perl 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 General Public License (GPL) Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave, Cambridge, MA 02139, USA. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU 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. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), 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 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 show them these terms so they know 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. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. 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 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 derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 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 License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. 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. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary 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 License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 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 Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing 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 for copying, distributing or modifying the Program or works based on it. 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. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. 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 this 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 this License, you may choose any version ever published by the Free Software Foundation. 10. 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 11. 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. 12. 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 --------------------------------------------------------------------------- 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. Aggregation of this Package with a commercial distribution is always permitted provided that the use of this Package is embedded; that is, when no overt attempt is made to make this Package's interfaces visible to the end user of the commercial distribution. Such use shall not be construed as a distribution of this Package. 9. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 10. 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 MARC-Fast-0.12/README0000644000175000017500000000063212205652766013621 0ustar dpavlindpavlinpod2text MARC::Fast.pm > README If this is still here it means the programmer was too lazy to create the readme file. You can create it now by using the command shown above from this directory. At the very least you should be able to use this set of instructions to install the module... perl Makefile.PL make make test make install If you are on a windows box you should use 'nmake' rather than 'make'. MARC-Fast-0.12/Makefile.PL0000644000175000017500000000202012205652766014704 0ustar dpavlindpavlinuse ExtUtils::MakeMaker; # See lib/ExtUtils/MakeMaker.pm for details of how to influence # the contents of the Makefile that is written. WriteMakefile( NAME => 'MARC::Fast', VERSION_FROM => 'lib/MARC/Fast.pm', # finds $VERSION AUTHOR => 'Dobrica Pavlinusic (dpavlin@rot13.org)', ABSTRACT => '', PREREQ_PM => { 'Test::Simple' => 0.44, 'Data::Dump' => 0, 'Carp' => 0, }, META_MERGE => { resources => { license => 'http://www.gnu.org/licenses/gpl-2.0.html', bugtracker => 'https://rt.cpan.org/Public/Dist/Display.html?Name=MARC-Fast', repository => 'http://github.com/dpavlin/MARC-Fast' }, }, ); sub MY::postamble { return <<'MAKE_MORE'; changelog: git log > Changes cpan: make clean rm -f MARC-Fast-*.tar.gz perl Makefile.PL make changelog make dist make disttest @echo @echo -n "Upload" MARC-Fast-*.tar.gz "to CPAN? [y/N]:" @read upload && test "$$upload" == "y" && cpan-upload -verbose MARC-Fast-*.tar.gz MAKE_MORE } MARC-Fast-0.12/META.yml0000644000175000017500000000140312205653021014170 0ustar dpavlindpavlin--- #YAML:1.0 name: MARC-Fast version: 0.12 abstract: author: - Dobrica Pavlinusic (dpavlin@rot13.org) license: unknown distribution_type: module configure_requires: ExtUtils::MakeMaker: 0 build_requires: ExtUtils::MakeMaker: 0 requires: Carp: 0 Data::Dump: 0 Test::Simple: 0.44 resources: bugtracker: https://rt.cpan.org/Public/Dist/Display.html?Name=MARC-Fast license: http://www.gnu.org/licenses/gpl-2.0.html repository: http://github.com/dpavlin/MARC-Fast no_index: directory: - t - inc generated_by: ExtUtils::MakeMaker version 6.57_05 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 MARC-Fast-0.12/Changes0000644000175000017500000003472112205653021014223 0ustar dpavlindpavlincommit 4ed177eeead2afff1d64a38fce08780baf679bda Author: Dobrica Pavlinusic Date: Thu Aug 22 13:50:57 2013 +0200 added test to manifest commit ba7f6ac0e66a6b8090255b9527393639e7cce860 Author: Dobrica Pavlinusic Date: Thu Aug 22 13:49:58 2013 +0200 added resources to META.yml commit 935e0fcb29c3965a40d793b1517445d106b4c822 Author: Dobrica Pavlinusic Date: Thu Aug 22 13:38:38 2013 +0200 generate Changes from git commit 467b53f1a035f532af3fa75afc1fd522fdf6bba6 Author: Dobrica Pavlinusic Date: Thu Aug 22 11:24:36 2013 +0000 added hash_filter as option when calling to_hash [0.12] git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/MARC-Fast/trunk@47 49f9634a-d7ec-0310-8e6b-ec35c6cc8804 commit da0d66efdc1d4735f05935a6300a408e7f3ac503 Author: Dobrica Pavlinusic Date: Thu Aug 22 10:48:18 2013 +0000 dump tsv file for TokyoCabinet import git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/MARC-Fast/trunk@46 49f9634a-d7ec-0310-8e6b-ec35c6cc8804 commit 614bfc043eeaa5f8ae8de780d281d229021efc64 Author: Dobrica Pavlinusic Date: Thu Sep 23 13:51:58 2010 +0000 update MANIFEST git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/MARC-Fast/trunk@45 49f9634a-d7ec-0310-8e6b-ec35c6cc8804 commit 2448cacb6d649bec715fbdeb95606f0cfd76b9a3 Author: Dobrica Pavlinusic Date: Thu Sep 23 13:15:01 2010 +0000 bump version to [0.11] git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/MARC-Fast/trunk@44 49f9634a-d7ec-0310-8e6b-ec35c6cc8804 commit 01a39d84c74ffc4a3553eff9a57a10ae0231a850 Author: Dobrica Pavlinusic Date: Thu Sep 23 13:14:37 2010 +0000 better example with repetable field and subfields git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/MARC-Fast/trunk@43 49f9634a-d7ec-0310-8e6b-ec35c6cc8804 commit 4c444f30647dedeeaea1300adf8ba3e60d1f63f3 Author: Dobrica Pavlinusic Date: Thu Sep 23 13:07:28 2010 +0000 fix repeatable subfields in to_hash git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/MARC-Fast/trunk@42 49f9634a-d7ec-0310-8e6b-ec35c6cc8804 commit 8c6a77a95fedbce3e3d4ac2bc6adde00efe9793a Author: Dobrica Pavlinusic Date: Thu Sep 23 13:06:25 2010 +0000 test data with repeatable subfield git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/MARC-Fast/trunk@41 49f9634a-d7ec-0310-8e6b-ec35c6cc8804 commit eec94e2b3979b427ee2bb064c76ed364f2d53568 Author: Dobrica Pavlinusic Date: Thu Sep 23 13:05:59 2010 +0000 test repeatable subfields git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/MARC-Fast/trunk@40 49f9634a-d7ec-0310-8e6b-ec35c6cc8804 commit 7d7050d2aa6010d484860a54425a9ceff781283c Author: Dobrica Pavlinusic Date: Thu Sep 23 12:55:35 2010 +0000 move Fast.pm into lib/MARC/Fast.pm git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/MARC-Fast/trunk@39 49f9634a-d7ec-0310-8e6b-ec35c6cc8804 commit cabfd93a9ff6f82e8b67e3050ca3c2ea1ef0af37 Author: Dobrica Pavlinusic Date: Thu Sep 23 12:29:37 2010 +0000 use file from $marc_file variable git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/MARC-Fast/trunk@38 49f9634a-d7ec-0310-8e6b-ec35c6cc8804 commit 01dc793451bb00d0a95e6b2e70ee0e8882bdf0b7 Author: Dobrica Pavlinusic Date: Thu Sep 23 12:26:42 2010 +0000 use lib instead of blib for local testing git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/MARC-Fast/trunk@37 49f9634a-d7ec-0310-8e6b-ec35c6cc8804 commit 0dbe189e6984e2dd51cc903ffbbfa98094dd9f65 Author: Dobrica Pavlinusic Date: Thu Sep 23 12:24:38 2010 +0000 rename tag number to $tag git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/MARC-Fast/trunk@36 49f9634a-d7ec-0310-8e6b-ec35c6cc8804 commit 798e5a294ff67a1ff4dbd8b7ecfb97020929daa4 Author: Dobrica Pavlinusic Date: Thu Feb 4 17:15:09 2010 +0000 bump version [0.10] git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/MARC-Fast/trunk@35 49f9634a-d7ec-0310-8e6b-ec35c6cc8804 commit 4050a1d1d424433e2efd84be09d59014f24f07a5 Author: Dobrica Pavlinusic Date: Thu Feb 4 17:14:52 2010 +0000 add utf-8 tests and data into MANIFEST git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/MARC-Fast/trunk@34 49f9634a-d7ec-0310-8e6b-ec35c6cc8804 commit c9df7a8379b2016ab44b0427198a193c4a98cf2e Author: Dobrica Pavlinusic Date: Thu Feb 4 17:13:18 2010 +0000 don't card on junk at end, just warn git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/MARC-Fast/trunk@33 49f9634a-d7ec-0310-8e6b-ec35c6cc8804 commit 3155b9de32d2a7c8231fb4599b9061362ee775f7 Author: Dobrica Pavlinusic Date: Thu Feb 4 17:10:14 2010 +0000 added test and data for utf-8 encoding example git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/MARC-Fast/trunk@32 49f9634a-d7ec-0310-8e6b-ec35c6cc8804 commit df7293d3cca255a7a43c0e78606fd113c8970725 Author: Dobrica Pavlinusic Date: Thu Feb 4 17:09:49 2010 +0000 return correct count for marc files with additional junk bytes at end git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/MARC-Fast/trunk@31 49f9634a-d7ec-0310-8e6b-ec35c6cc8804 commit 64db2e9e31595d73daddd3ee2bc628604fd82a1d Author: Dobrica Pavlinusic Date: Thu Feb 4 17:08:03 2010 +0000 added documentation about utf-8 encoded marc files and utf-8 flag in perl scalars git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/MARC-Fast/trunk@30 49f9634a-d7ec-0310-8e6b-ec35c6cc8804 commit 936318a1af91fe3ac5ef2a91630af1097c6159c2 Author: Dobrica Pavlinusic Date: Thu Feb 4 12:54:00 2010 +0000 don't depend on Test::Exception git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/MARC-Fast/trunk@29 49f9634a-d7ec-0310-8e6b-ec35c6cc8804 commit 8bc90e39e0a8a20521a51e0e70aa6941499bde8a Author: Dobrica Pavlinusic Date: Sat Sep 6 10:40:52 2008 +0000 include_subfields with option -h git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/MARC-Fast/trunk@28 49f9634a-d7ec-0310-8e6b-ec35c6cc8804 commit 7434f8f97fce6913ee8b223942daa9965bfb16cd Author: Dobrica Pavlinusic Date: Sun Aug 3 06:49:12 2008 +0000 pull Changes from svk and release to CPAN 0.09 git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/MARC-Fast/trunk@27 49f9634a-d7ec-0310-8e6b-ec35c6cc8804 commit 5fc18887422d2dd62c716b73d81a226f3a295e5b Author: Dobrica Pavlinusic Date: Mon Nov 19 16:37:00 2007 +0000 use Data::Dump for nicer (shorter/more readable) output instead of Data::Dumper git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/MARC-Fast/trunk@26 49f9634a-d7ec-0310-8e6b-ec35c6cc8804 commit 3d844dfbf091bc62a45aff80189d402d1f9cba1f Author: Dobrica Pavlinusic Date: Tue Nov 6 20:06:26 2007 +0000 include subfields in to_hash dump git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/MARC-Fast/trunk@25 49f9634a-d7ec-0310-8e6b-ec35c6cc8804 commit 8ddb954243aacc37ee72801b9f1d969d893a5f85 Author: Dobrica Pavlinusic Date: Tue Nov 6 20:06:07 2007 +0000 correctly upgrade repeatable field value to array git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/MARC-Fast/trunk@24 49f9634a-d7ec-0310-8e6b-ec35c6cc8804 commit 1677866871d5303a178499e33f86e3c02af57877 Author: Dobrica Pavlinusic Date: Sun Nov 4 22:44:42 2007 +0000 much more sane implementation of to_hash which now include option include_subfields just like Biblio::Isis does. [0.09] git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/MARC-Fast/trunk@23 49f9634a-d7ec-0310-8e6b-ec35c6cc8804 commit a3bc3c51dfc371f2e18b3f719db239480e4a16e0 Author: Dobrica Pavlinusic Date: Tue Oct 30 16:41:06 2007 +0000 display also leader in dump git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/MARC-Fast/trunk@22 49f9634a-d7ec-0310-8e6b-ec35c6cc8804 commit 2908568e3d5cbbae3ae26230f2c56d8b0b2ee24e Author: Dobrica Pavlinusic Date: Mon Oct 29 22:41:21 2007 +0000 correctly skip tests if there is no test MARC file git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/MARC-Fast/trunk@21 49f9634a-d7ec-0310-8e6b-ec35c6cc8804 commit c47ff33da7b163d95a3aa222fd5bff4734c81ce2 Author: Dobrica Pavlinusic Date: Mon Oct 29 22:40:58 2007 +0000 update git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/MARC-Fast/trunk@20 49f9634a-d7ec-0310-8e6b-ec35c6cc8804 commit 12f18ad14a52dc83e3449d908fb0678e16dabb49 Author: Dobrica Pavlinusic Date: Mon Oct 29 22:38:55 2007 +0000 included sample marc file from MARC-Record-2.0 git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/MARC-Fast/trunk@19 49f9634a-d7ec-0310-8e6b-ec35c6cc8804 commit a1d1939c89e83f096a59468d10bf1b5eb2214403 Author: Dobrica Pavlinusic Date: Mon Oct 29 22:33:35 2007 +0000 added $marc->last_leader which returns leader of last record accessed with $marc->fetch bump version to [0.08] git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/MARC-Fast/trunk@18 49f9634a-d7ec-0310-8e6b-ec35c6cc8804 commit 8b141e94aa130f0b8e50d89a2d57d1d1971f9f2b Author: Dobrica Pavlinusic Date: Thu Jun 21 10:24:12 2007 +0000 update version [0.07] git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/MARC-Fast/trunk@17 49f9634a-d7ec-0310-8e6b-ec35c6cc8804 commit 32a687e3527bec06b7a15ccceb53e6ba9f5d272a Author: Dobrica Pavlinusic Date: Thu Jun 21 10:23:12 2007 +0000 make Data::Dump optional git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/MARC-Fast/trunk@16 49f9634a-d7ec-0310-8e6b-ec35c6cc8804 commit 167dbfe1834fcf672e526e460c27846182ccaf5d Author: Dobrica Pavlinusic Date: Thu Jun 21 10:05:39 2007 +0000 auto-generated from svn log git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/MARC-Fast/trunk@15 49f9634a-d7ec-0310-8e6b-ec35c6cc8804 commit e930b654bfda26d405ef840dce8918baeaf1208b Author: Dobrica Pavlinusic Date: Mon Jun 18 22:54:02 2007 +0000 push new (slim) version [0.06] git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/MARC-Fast/trunk@14 49f9634a-d7ec-0310-8e6b-ec35c6cc8804 commit 8d434a1c9a1414e59e7a802cae41877bef3307e4 Author: Dobrica Pavlinusic Date: Mon Jun 18 22:51:04 2007 +0000 remove huge unimarc.iso file from distribution git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/MARC-Fast/trunk@13 49f9634a-d7ec-0310-8e6b-ec35c6cc8804 commit f05bfba5ef7cefc8fff3a2bf0583ebd12c4fed88 Author: Dobrica Pavlinusic Date: Mon Jun 18 22:32:41 2007 +0000 release preparation git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/MARC-Fast/trunk@12 49f9634a-d7ec-0310-8e6b-ec35c6cc8804 commit be2299900879d2c12a99cb9728a9113c85c6d8e8 Author: Dobrica Pavlinusic Date: Fri Nov 3 20:34:31 2006 +0000 added to_ascii to be more like Biblio::ISIS API [0.05] git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/MARC-Fast/trunk@11 49f9634a-d7ec-0310-8e6b-ec35c6cc8804 commit 79218e828e9e2e78f8b8c0f54be1ca9b99937d55 Author: Dobrica Pavlinusic Date: Fri Nov 3 20:07:58 2006 +0000 change terminology to offset and limit git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/MARC-Fast/trunk@10 49f9634a-d7ec-0310-8e6b-ec35c6cc8804 commit b9f79b2dd586279171a83a095f2fae4714f86a5f Author: Dobrica Pavlinusic Date: Thu Jul 13 14:00:23 2006 +0000 hash_filter now gets record number as second arguments to be in sync with Biblio::Isis 0.22 git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/MARC-Fast/trunk@9 49f9634a-d7ec-0310-8e6b-ec35c6cc8804 commit 7740f0733c542c4a23750b42508d382d27e2e57d Author: Dobrica Pavlinusic Date: Wed Dec 28 22:16:39 2005 +0000 documented hash_filter, fully implemented repeatable subfileds. [0.03] git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/MARC-Fast/trunk@8 49f9634a-d7ec-0310-8e6b-ec35c6cc8804 commit 1eb9ffc53258d90a524ef05e88d9321c042def92 Author: Dobrica Pavlinusic Date: Wed Dec 28 22:03:24 2005 +0000 pod documentation, new options, much nicer output git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/MARC-Fast/trunk@7 49f9634a-d7ec-0310-8e6b-ec35c6cc8804 commit 8300e4b53e83d8a355dba26d74624d521f67232f Author: Dobrica Pavlinusic Date: Sun Dec 18 23:12:26 2005 +0000 added to_hash, small fix to test, better output in dump_fastmarc.pl [0.02] git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/MARC-Fast/trunk@6 49f9634a-d7ec-0310-8e6b-ec35c6cc8804 commit 96b41f990776b11c9bb1824d34cb93c368985053 Author: Dobrica Pavlinusic Date: Sat Oct 8 16:33:09 2005 +0000 convert repeatable fileds into repeatable subfields git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/MARC-Fast/trunk@5 49f9634a-d7ec-0310-8e6b-ec35c6cc8804 commit bf7a8cd995686ae3652408d5c58067aba565bf2a Author: Dobrica Pavlinusic Date: Sat Oct 8 16:32:54 2005 +0000 added option -n number to dump just one record and -d for debug git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/MARC-Fast/trunk@4 49f9634a-d7ec-0310-8e6b-ec35c6cc8804 commit eb411e96a84d82b31bc173025803b2d7dd8ab404 Author: Dobrica Pavlinusic Date: Fri Apr 8 12:19:24 2005 +0000 dump sorted fields git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/MARC-Fast/trunk@3 49f9634a-d7ec-0310-8e6b-ec35c6cc8804 commit fd2dd8625b3852a898b0a75237c862aa787208d4 Author: Dobrica Pavlinusic Date: Tue Jan 4 15:32:54 2005 +0000 check for test data and skip tests if it doesn't exists git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/MARC-Fast/trunk@2 49f9634a-d7ec-0310-8e6b-ec35c6cc8804 commit 5c5233ec1192462b4f0e5d30ba274f1b09cc69fc Author: Dobrica Pavlinusic Date: Tue Jan 4 10:26:07 2005 +0000 initital import of 0.01 into subversion git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/MARC-Fast/trunk@1 49f9634a-d7ec-0310-8e6b-ec35c6cc8804 MARC-Fast-0.12/MANIFEST0000644000175000017500000000040412205652766014067 0ustar dpavlindpavlinChanges lib/MARC/Fast.pm LICENSE Makefile.PL MANIFEST META.yml Module meta-data (added by MakeMaker) README scripts/dump_fastmarc.pl t/001_marc.t t/002_marc-utf8.t t/003_marc-repeatable.t t/camel.usmarc t/koha-232766.mrc t/utf8.marc t/004_marc-hash_filter.t MARC-Fast-0.12/t/0002755000175000017500000000000012205653021013166 5ustar dpavlindpavlinMARC-Fast-0.12/t/004_marc-hash_filter.t0000755000175000017500000000173112205652766017170 0ustar dpavlindpavlin#!/usr/bin/perl -w use strict; use blib; use Test::More tests => 9; use Data::Dump qw/dump/; BEGIN { use_ok( 'MARC::Fast' ); use_ok( 'Encode' ); } my $debug = shift @ARGV; my $marc_file = 't/utf8.marc'; ok(my $marc = MARC::Fast->new( marcdb => $marc_file, hash_filter => sub { my ($l, $tag) = @_; $l = Encode::decode( 'utf-8', $l ); $l =~ s/knjiga/briga/; return $l; }, ), "new"); cmp_ok($marc->count, '==', 1, 'count' ); ok(my $rec = $marc->fetch(1), "fetch 1"); diag dump $rec if $debug; ok(my $hash = $marc->to_hash(1), "to_hash 1"); diag dump $hash if $debug; cmp_ok( $hash->{260}->[0]->{'b'}, 'eq', "\x{160}kolska briga,", 'hash_filter from new' ); ok($hash = $marc->to_hash(1, hash_filter => sub { my ($l, $tag) = @_; $l = Encode::decode( 'utf-8', $l ); $l =~ s/knjiga/zabava/; return $l; }), "to_hash 1 with hash_filter"); diag dump $hash if $debug; cmp_ok( $hash->{260}->[0]->{'b'}, 'eq', "\x{160}kolska zabava,", 'hash_filter from to_hash' ); MARC-Fast-0.12/t/utf8.marc0000644000175000017500000000301212205652766014731 0ustar dpavlindpavlin01545nam a2200361ui 4500008004100000035001900041040003300060080001500093080000800108100002000116245010300136250002500239260003800264300004600302504003200348504001100380653001700391653001600408653002500424942007800449952012500527952012500652952010600777952010500883952010600988991001401094991001301108991001401121991001301135991001301148992001101161999001101172020118s1988 ||| |||||||||| ||hrv|d aHR-ZaFF iznL41 aHR-ZaFFbhrvcHR-ZaFFeppiak a519.21:007 a0071 aPauše, Željko10aVjerojatnost :binformacija, stohastički procesi : pojmovi - metode - primjene /cŽeljko Pauše. a4. promijenjeno izd. aZagreb :bŠkolska knjiga,c1988. aXVI, 263 str. : bgraf. prikazi ; c24 cm aStr. 259-250: Bibliografija aKazalo avjerojatnost ainformacija astohastički procesi bLIBcKNJdIZN | 519.21 | PAU | v | 519.21D | PAU | vhBBiPAU v6BB_PAU_V w2008-10-15p1301000051r2008-10-1540006BB_PAU_V951bFFZG10oBB PAU vd2008-10-15iizn91/788IZN70cOPBByKNJaFFZG w2008-10-15p1301000050r2008-10-1540006BB_PAU_V950bFFZG10oBB PAU vd2008-10-15iizn91/778IZN70cOPBByKNJaFFZG w2008-10-15p1301000049r2008-10-154000949bFFZG10d2008-10-15iizn90/36D8IZN70cZSPOyKNJaFFZG w2008-10-15p1301000048r2008-10-154000948bFFZG10d2008-10-15iizn90/358IZN70cZSPOyKNJaFFZG w2008-10-15p1301000047r2008-10-154000947bFFZG10d2008-10-15iizn90/34D8IZN70cZSPOyKNJaFFZG aizn90/34D aizn90/35 aizn90/36D aizn91/77 aizn91/78 aIZbAP c45d45 MARC-Fast-0.12/t/001_marc.t0000755000175000017500000000315412205652766014700 0ustar dpavlindpavlin#!/usr/bin/perl -w use strict; use blib; use Test::More tests => 63; use Data::Dump qw/dump/; BEGIN { use_ok( 'MARC::Fast' ); } my $debug = shift @ARGV; my $marc_file = 't/camel.usmarc'; my $marc; my %param; eval { $marc = MARC::Fast->new(%param) }; ok( $@ =~ /marcdb/, "marcdb parametar" ); $param{marcdb} = '/foo/bar/file'; eval { $marc = MARC::Fast->new(%param) }; ok( $@ =~ /foo.bar/, "marcdb exist" ); $param{marcdb} = $marc_file if -e $marc_file; SKIP: { skip "no $param{marcdb} test file ", 37 unless (-e $param{marcdb}); diag "marc file: $marc_file"; ok($marc = MARC::Fast->new(%param), "new"); isa_ok ($marc, 'MARC::Fast'); #diag Dumper($marc); cmp_ok($marc->count, '==', scalar @{$marc->{leader}}, "count == leader"); cmp_ok($marc->count, '==', scalar @{$marc->{fh_offset}}, "count == fh_offset"); ok(! $marc->fetch(0), "fetch 0"); ok(! $marc->last_leader, "no last_leader"); ok($marc->fetch($marc->count), "fetch max:".$marc->count); ok(! $marc->fetch($marc->count + 1), "fetch max+1:".($marc->count+1)); foreach (1 .. 10) { ok($marc->fetch($_), "fetch($_)"); ok($marc->last_leader, "last_leader $_"); ok(my $hash = $marc->to_hash($_), "to_hash($_)"); diag "to_hash($_) = ",Data::Dump::dump($hash) if ($debug); ok(my $hash_sf = $marc->to_hash($_, include_subfields => 1), "to_hash($_,include_subfields)"); diag "to_hash($_, include_subfields => 1) = ",Data::Dump::dump($hash_sf) if ($debug); ok(my $ascii = $marc->to_ascii($_), "to_ascii($_)"); diag "to_ascii($_) ::\n$ascii" if ($debug); } ok(! $marc->fetch(0), "fetch(0) again"); ok(! $marc->last_leader, "no last_leader"); } MARC-Fast-0.12/t/koha-232766.mrc0000644000175000017500000000505012205652766015377 0ustar dpavlindpavlin02600cam a22003617i 450000500170000000800410001702000180005804000410007604100080011704400070012508000150013208000120014710000220015924500390018126001230022030000330034344000540037650400320043065300190046265300410048194200360052295201710055895201710072995201590090095201710105995201710123095201590140195201590156095201710171995201590189095201700204999900190221920090505094831.0090128s2009 hr a r 000 0 hrv  a9789531753319 aHR NSKbhrvcHR NSKeppiakdHR-ZaFF 0 ahrv ahr a930.25:004 a025:0041 aStančić, Hrvoje10aDigitalizacija /cHrvoje Stančić aZagreb :bZavod za informacijske studije Odsjeka za informacijske znanosti Filozofskog fakulteta Sveučilišta,c2009. a171 str. :bilustr. ;c24 cm 0aRadovi Zavoda za informacijske studije ;vknj. 19 aBibliografija: str. 165-171 adigitalizacija aknjižnična građaaarhivska građa cKNJhBG04.8iSTA d6BG048_STA_D w2009-05-05p1302008428r2010-07-0240006BG048_STA_D9292858bFFZGm510oBG04.8 STA dd2009-05-05q2010-09-13tizn18/2009z08IZN70cOPBGyKNJs2010-07-02l5aFFZG w2009-05-05p1302008427r2010-05-2140006BG048_STA_D9292857bFFZGm510oBG04.8 STA dd2009-05-05q2010-11-23tizn17/2009z08IZN70cOPBGyKNJs2010-05-21l4aFFZG w2009-05-05p1302008426r2010-09-1740006BG048_STA_D9292856bFFZGm910oBG04.8 STA dd2009-05-05tizn16/2009z08IZN70cOPBGyKNJs2010-07-07l9aFFZG w2009-05-05p1302008425r2010-03-1140006BG048_STA_D9292855bFFZGm710oBG04.8 STA dd2009-05-05q2011-03-18tizn15/2009z08IZN70cOPBGyKNJs2010-03-11l5aFFZG w2009-05-05p1302008424r2010-04-3040006BG048_STA_D9292854bFFZGm410oBG04.8 STA dd2009-05-05q2010-11-03tizn14/2009z08IZN70cOPBGyKNJs2010-04-30l7aFFZG w2009-05-05p1302008423r2010-09-0940006BG048_STA_D9292853bFFZGm210oBG04.8 STA dd2009-05-05tizn13/2009z08IZN70cOPBGyKNJs2010-07-12l5aFFZG w2009-05-05p1302008422r2010-05-0640006BG048_STA_D9292852bFFZGm710oBG04.8 STA dd2009-05-05tizn12/2009z08IZN70cOPBGyKNJs2010-03-23l7aFFZG w2009-05-05p1302008421r2010-07-1240006BG048_STA_D9292851bFFZGm910oBG04.8 STA dd2009-05-05q2010-09-23tizn11/2009z08IZN70cOPBGyKNJs2010-07-12l6aFFZG w2009-05-05p1302008420r2010-09-1340006BG048_STA_D9292850bFFZGm610oBG04.8 STA dd2009-05-05tizn10/2009z08IZN70cOPBGyKNJs2010-09-13l9aFFZG w2009-05-05p1302008415r2010-09-1040006BG048_STA_D9292845bFFZGm710oBG04.8 STA dd2009-05-05q2010-09-24tizn9/2009z08IZN70cOPBGyKNJs2010-09-10l7aFFZG c232766d232766MARC-Fast-0.12/t/002_marc-utf8.t0000755000175000017500000000112712205652766015563 0ustar dpavlindpavlin#!/usr/bin/perl -w use strict; use blib; use Test::More tests => 7; use Data::Dump qw/dump/; BEGIN { use_ok( 'MARC::Fast' ); use_ok( 'Encode' ); } my $debug = shift @ARGV; my $marc_file = 't/utf8.marc'; ok(my $marc = MARC::Fast->new( marcdb => $marc_file, hash_filter => sub { Encode::decode( 'utf-8', $_[0] ); }, ), "new"); cmp_ok($marc->count, '==', 1, 'count' ); ok(my $rec = $marc->fetch(1), "fetch 1"); diag dump $rec if $debug; ok(my $hash = $marc->to_hash(1), "to_hash 1"); diag dump $hash if $debug; ok( $hash->{260}->[0]->{'b'} eq "\x{160}kolska knjiga,", 'utf-8 flag' ); MARC-Fast-0.12/t/003_marc-repeatable.t0000755000175000017500000000122712205652766017003 0ustar dpavlindpavlin#!/usr/bin/perl -w use strict; use lib 'lib'; use Test::More tests => 8; use Data::Dump qw/dump/; BEGIN { use_ok( 'MARC::Fast' ); use_ok( 'Encode' ); } my $debug = shift @ARGV; my $marc_file = 't/koha-232766.mrc'; ok(my $marc = MARC::Fast->new( marcdb => $marc_file, ), "new"); cmp_ok($marc->count, '==', 1, 'count' ); ok(my $rec = $marc->fetch(1), "fetch 1"); diag dump $rec if $debug; ok(my $hash = $marc->to_hash(1, include_subfields => 1), "to_hash 1 include_subfields"); diag dump $hash if $debug; ok( ref $hash->{653}->[0]->{'a'} eq '', 'first occurance not repeatable' ); ok( ref $hash->{653}->[1]->{'a'} eq 'ARRAY', 'second is repetable' ); MARC-Fast-0.12/t/camel.usmarc0000644000175000017500000001467712205652766015517 0ustar dpavlindpavlin00755cam 22002414a 4500001001300000003000600013005001700019008004100036010001700077020004300094040001800137042000800155050002600163082001700189100003100206245005400237260004200291300007200333500003300405650003700438630002500475630001300500fol05731351 IMchF20000613133448.0000107s2000 nyua 001 0 eng  a 00020737  a0471383147 (paper/cd-rom : alk. paper) aDLCcDLCdDLC apcc00aQA76.73.P22bM33 200000a005.13/32211 aMartinsson, Tobias,d1976-10aActivePerl with ASP and ADO /cTobias Martinsson. aNew York :bJohn Wiley & Sons,c2000. axxi, 289 p. :bill. ;c23 cm. +e1 computer laser disc (4 3/4 in.) a"Wiley Computer Publishing." 0aPerl (Computer program language)00aActive server pages.00aActiveX.00647pam 2200241 a 4500001001300000003000600013005001700019008004100036010001700077020001500094040001800109042000800127050002600135082001500161100002600176245006700202260003800269263000900307300001100316650003700327650002500364700001600389fol05754809 IMchF20000601115601.0000203s2000 mau 001 0 eng  a 00022023  a1565926994 aDLCcDLCdDLC apcc00aQA76.73.P22bD47 200000a005.742211 aDescartes, Alligator.10aProgramming the Perl DBI /cAlligator Descartes and Tim Bunce. aCmabridge, MA :bO'Reilly,c2000. a1111 ap. cm. 0aPerl (Computer program language) 0aDatabase management.1 aBunce, Tim.00605cam 22002054a 4500001001300000003000600013005001700019008004100036010001700077040001800094042000800112050002700120082001700147100002100164245005500185260004500240300002600285504005100311650003700362fol05843555 IMchF20000525142739.0000318s1999 cau b 001 0 eng  a 00501349  aDLCcDLCdDLC apcc00aQA76.73.P22bB763 199900a005.13/32211 aBrown, Martin C.10aPerl :bprogrammer's reference /cMartin C. Brown. aBerkeley :bOsborne/McGraw-Hill,cc1999. axix, 380 p. ;c22 cm. aIncludes bibliographical references and index. 0aPerl (Computer program language)00579cam 22002054a 4500001001300000003000600013005001700019008004100036010001700077020001500094040001800109042000800127050002700135082001700162100002100179245005500200260004500255300003600300650003700336fol05843579 IMchF20000525142716.0000318s1999 caua 001 0 eng  a 00502116  a0072120002 aDLCcDLCdDLC apcc00aQA76.73.P22bB762 199900a005.13/32211 aBrown, Martin C.10aPerl :bthe complete reference /cMartin C. Brown. aBerkeley :bOsborne/McGraw-Hill,cc1999. axxxv, 1179 p. :bill. ;c24 cm. 0aPerl (Computer program language)00801nam 22002778a 4500001001300000003000600013005001700019008004100036010001700077020001500094040001300109042000800122050002600130082001800156100002000174245008800194250003200282260004100314263000900355300001100364650003700375650003600412650002600448700002500474700002400499fol05848297 IMchF20000524125727.0000518s2000 mau 001 0 eng  a 00041664  a1565924193 aDLCcDLC apcc00aQA76.73.P22bG84 200000a005.2/7622211 aGuelich, Scott.10aCGI programming with Perl /cScott Guelich, Shishir Gundavaram & Gunther Birznieks. a2nd ed., expanded & updated aCambridge, Mass. :bO'Reilly,c2000. a0006 ap. cm. 0aPerl (Computer program language) 0aCGI (Computer network protocol) 0aInternet programming.1 aGundavaram, Shishir.1 aBirznieks, Gunther.00665nam 22002298a 4500001001300000003000600013005001700019008004100036010001700077020001500094040001300109042000800122050002700130082001700157111005200174245008600226250001200312260004100324263000900365300001100374650005000385fol05865950 IMchF20000615103017.0000612s2000 mau 100 0 eng  a 00055759  a0596000138 aDLCcDLC apcc00aQA76.73.P22bP475 200000a005.13/32212 aPerl Conference 4.0d(2000 :cMonterey, Calif.)10aProceedings of the Perl Conference 4.0 :bJuly 17-20, 2000, Monterey, California. a1st ed. aCambridge, Mass. :bO'Reilly,c2000. a0006 ap. cm. 0aPerl (Computer program language)vCongresses.00579nam 22002178a 4500001001300000003000600013005001700019008004100036010001700077020001500094040001300109042000800122050002600130082001700156100002800173245006200201260004100263263000900304300001100313650003700324fol05865956 IMchF20000615102948.0000612s2000 mau 000 0 eng  a 00055770  a1565926099 aDLCcDLC apcc00aQA76.73.P22bB43 200000a005.13/32211 aBlank-Edelman, David N.10aPerl for system administration /cDavid N. Blank-Edelman. aCambridge, Mass. :bO'Reilly,c2000. a0006 ap. cm. 0aPerl (Computer program language)00661nam 22002538a 4500001001300000003000600013005001700019008004100036010001700077020001500094040001300109042000800122050002600130082001700156100001700173245006700190250001200257260004100269263000900310300001100319650003700330700002300367700001700390fol05865967 IMchF20000615102611.0000614s2000 mau 000 0 eng  a 00055799  a0596000278 aDLCcDLC apcc00aQA76.73.P22bW35 200000a005.13/32211 aWall, Larry.10aProgramming Perl /cLarry Wall, Tom Christiansen & Jon Orwant. a3rd ed. aCambridge, Mass. :bO'Reilly,c2000. a0007 ap. cm. 0aPerl (Computer program language)1 aChristiansen, Tom.1 aOrwant, Jon.00603cam 22002054a 4500001001300000003000600013005001700019008004100036010001700077020001500094040001800109042000800127050002600135082001700161100003200178245006000210260005700270300003300327650003700360fol05872355 IMchF20000706095105.0000315s1999 njua 001 0 eng  a 00500678  a013020868X aDLCcDLCdDLC apcc00aQA76.73.P22bL69 199900a005.13/32211 aLowe, Vincentq(Vincent D.)10aPerl programmer's interactive workbook /cVincent Lowe. aUpper Saddle River, NJ :bPrentice Hall PTP,cc1999. axx, 633 p. :bill. ;c23 cm. 0aPerl (Computer program language)00696nam 22002538a 4500001001300000003000600013005001700019008004100036010001700077020002800094040001300122042000800135050002600143082001700169100002600186245004400212260005100256263000900307300001100316500002000327650003700347650001700384650004100401fol05882032 IMchF20000707091904.0000630s2000 cau 001 0 eng  a 00058174  a0764547291 (alk. paper) aDLCcDLC apcc00aQA76.73.P22bF64 200000a005.13/32212 aFoster-Johnson, Eric.10aCross-platform Perl /cEric F. Johnson. aFoster City, CA :bIDG Books Worldwide,c2000. a0009 ap. cm. aIncludes index. 0aPerl (Computer program language) 0aWeb servers. 0aCross-platform software development.MARC-Fast-0.12/scripts/0002755000175000017500000000000012205653021014412 5ustar dpavlindpavlinMARC-Fast-0.12/scripts/dump_fastmarc.pl0000755000175000017500000000261512205652766017620 0ustar dpavlindpavlin#!/usr/bin/perl -w use strict; use lib 'lib'; use MARC::Fast; use Getopt::Std; use Data::Dump qw/dump/; =head1 NAME dump_fastmarc.pl - display MARC records =head2 USAGE dump_fastmarc.pl /path/to/dump.marc =head2 OPTIONS =over 16 =item -o offset dump records starting with C =item -l limit dump just C records =item -h dump result of C on record =item -d turn debugging output on =item -t dump tsv file for TokyoCabinet import =back =cut my %opt; getopts('do:l:ht', \%opt); my $file = shift @ARGV || die "usage: $0 [-o offset] [-l limit] [-h] [-d] file.marc\n"; my $marc = new MARC::Fast( marcdb => $file, debug => $opt{d}, ); my $min = 1; my $max = $marc->count; if (my $mfn = $opt{n}) { $min = $max = $mfn; print STDERR "Dumping $mfn only\n"; } elsif (my $limit = $opt{l}) { print STDERR "$file has $max records, using first $limit\n"; $max = $limit; } else { print STDERR "$file has $max records...\n"; } for my $mfn ($min .. $max) { my $rec = $marc->fetch($mfn) || next; warn "rec is ",dump($rec) if ($opt{d}); if ( $opt{t} ) { print "rec\t$mfn\tleader\t", $marc->last_leader, "\t"; my $ascii = $marc->to_ascii($mfn); $ascii =~ s{\n}{\t}gs; print "$ascii\n"; } else { print "REC $mfn\n"; print $marc->last_leader,"\n"; print $marc->to_ascii($mfn),"\n"; } warn "hash is ",dump($marc->to_hash($mfn, include_subfields => 1)) if ($opt{h}); }