On Wed, Feb 9, 2011 at 5:29 PM, Galen Charlton <gmcha...@gmail.com> wrote:
> The MARC::File::JSON module is consistent with other MARC::File::XXX
> modules that handle serializing and deserializing MARC::Record
> objects.
>
> MARC::Utils::MARC2Ini is an interesting concept, but it wouldn't take
> much work to recast it as MARC::File::Ini.  By using MARC::File::Foo
> serializers/deserializers, you could also avoid the need for an
> explicit MARC::Utils::MARC_in_JSON2Ini; instead, you could just do
> this:
>
> my $rec = MARC::File::JSON::decode($json);
> my $ini_string = MARC::File::Ini::encode($rec);
>

In the case of 2Ini, I can very well see it fitting well as MARC::File::Ini,
because the result of MARC2Ini is necessarily a string (because there
is no "native" Ini structure).  In the case of 2MARC_in_JSON (and
2Pairs), my thinking was more along the lines of having the native perl
data structure to work on.  That is, if a project would rather create
MARC records as a perl MARC_in_JSON hash rather than as "born"
MARC::Record objects, then there is a function for converting to
MARC::Record for sharing to the world as necessary.

I have to confess that I don't have a use case for this.  In part, I was
reacting to Paul's note about MARC::Loader, where they apparently
are creating MARC data as a hash and then converting to MARC::Record.

I'll pursue the Ini idea.  I had already thought about a record separator.
As it stands, the control fields are in a "null section" (represented
explicitly by "[_]" following Config::Tiny's example).  So this could be
the record separator when reading/writing files.

I had also thought about how to separate JSON records in a single file.
Perhaps this has been solved already, but I haven't seen a reference
to it.  If it were YAML, you could simply put "\n---\n" between the JSON
objects, and it would be simple to scan for that.

Anyway, I'll think through this some more and see what might fall out
as useful.

Thanks,

Brad

Reply via email to