Brad Baxter > MARC-Utils-MARC2MARC_in_JSON-0.05 > MARC::Utils::MARC2MARC_in_JSON

Download:
MARC-Utils-MARC2MARC_in_JSON-0.05.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.05   Source  

NAME ^

MARC::Utils::MARC2MARC_in_JSON - Perl module that provides routines to convert from a MARC::Record object to a MARC-in-JSON hash structure.

SYNOPSIS ^

    use MARC::Utils::MARC2MARC_in_JSON qw( marc2marc_in_json marc_in_json2marc each_record);

    $marc_in_json = marc2marc_in_json( $marc_record );
    $marc_record  = marc_in_json2marc( $marc_in_json );

    my $get_next = each_record( "marc.json" );
    while( my $record = $get_next->() ) {
        print get_title( $record );  # you write get_title()
    }

DESCRIPTION ^

MARC::Utils::MARC2MARC_in_JSON - Perl module that provides routines to convert from a MARC::Record object to a MARC-in-JSON hash structure as described here:

http://dilettantes.code4lib.org/blog/2010/09/a-proposal-to-serialize-marc-in-json/

Note that I did not say we were converting to JSON (though the name may seem to imply that). Instead, we are converting to a hash structure that is the same as you would get if you deserialized JSON text (in MARC-in-JSON format) to perl.

If you indeed want JSON, then you can simply use the JSON module to convert the hash.

The each_record() subroutine returns a closure that itself returns a MARC_in_JSON structure each time it's called. It is designed to be a proof-of-concept for my JSON Document Streaming proposal:

http://en.wikipedia.org/wiki/User:Baxter.brad/Drafts/JSON_Document_Streaming_Proposal

SEE ALSO ^

MARC::Record JSON

AUTHOR ^

Brad Baxter, <bbaxter@cpan.org>

COPYRIGHT AND LICENSE ^

Copyright (C) 2011 by Brad Baxter

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.2 or, at your option, any later version of Perl 5 you may have available.

syntax highlighting: