[librecat-dev] collaborate with Catmandu ?
Patrick.Hochstenbach at UGent.be
Mon Jan 21 16:33:51 CET 2019
Here is a small hello world example to show the basics of putting Catmandu in a Perl program
# Null is an import that imports one empty hash
my $importer = Catmandu->importer('Null');
# The fixer can have zero or more inline fixes or fix files
my $fixer = Catmandu->fixer(['add_field(hello,world)']);
# The YAML exporter writes YAML, when you provide as file
# a string reference it will write into that string
my $output = '';
my $exporter = Catmandu->exporter('YAML', file => \$output);
> On 14 Jan 2019, at 13:38, Patrick Hochstenbach <patrick.hochstenbach at ugent.be> wrote:
> Hi MARC
> Are you planning to be in Berlin in May by any chance? We have most of the Catmandu folks there at the ELAG conference. It would be good to have a chat on your project.
>> On 8 Jan 2019, at 15:26, Marc Chantreux <mc at unistra.fr> wrote:
>> Hi Patrick,
>> (happy new year to everyone if i didn't already whished it)
>>> Thanks Marc for this,
>> you're very welcome: you made an amazing job with catmandu and finally
>> had no opportunity to work with you guys.
>>> I’ve created for myself a reminder to look at your code.
>> Please feel very welcome to ask any question: it's probably easier for
>> me to dig into my memory than for you to read undocumented and
>> uncommented code.
>>> I still hope you will find somewhere your way back into
>>> library stuff a bit ;)
>> i really appreciate. thanks but no thanks: this is really
>> improbable as i love my current job here at Renater (FLOSS evangelist
>> and developer) and there isn't even an opportunity to work on library
>> related topics.
>> however, it doesn't mean we can't collaborate:
>> * catmandu is a multipurpose ETL and can be used to manipulate any
>> business object... probably including emails.
>> * in the sympa project (http://www.sympa.org), we have a system (called
>> "scenario") that provides a DSL to drive the dispatch of incoming emails.
>> my current work is a complete refactor of it to become
>> * extendable (as every keyword is bound to a function)
>> * composable (a scenario can contain other scenarii)
>> * easy to compose (everything will be stored as a IR (lisp alike)
>> format for a VM. as it's just data, scenarii can be build via
>> a web interface).
>> * maybe it could rely Catmandu components.
>> using our new DSL, we could implement the missing keyworkds
>> * importer to declare a source
>> * exporter to declare a destination
>> * fix to declare a fix
>> * from to open a stream of items from a source
>> * to to record the items of the current stream in an exporter
>> * iso-2709 to stream the content of some raw files to an importer
>> * a specification to CRUD the records. like
>> -999 to delete to remove all the 999 fields
>> 999$a to get the value of the 999$a subfield
>> we could write things like:
>> (importer 'old-libraries
>> (iso-2709 ('
>> (exporter 'transfered
>> (iso-2709 'to-be-transfered.utf8.raw ))
>> (exporter 'removed
>> (iso-2709 'new-library.utf8.raw ))
>> (fix 'to-utf8 (encoding-> marc8 utf8))
>> (fix 'dispatch-in-files
>> (if (~ .999$a /damaged|rejected/ )
>> (do (-999)
>> (to 'removed))
>> (to 'transfered)))
>> (from 'old-libraries
>> (do (fix 'to-utf8 (encoding-> marc8 utf8))
>> (fix 'dispatch-in-files))
>> the very begining of the code is here:
>> Also, we work on a boilerplate for our perl coding style:
>> If you see any way to share ideas, code, work between the two projects,
>> let us run a hackathon! ;) (or at least have a video conference about it).
More information about the librecat-dev