Skip to content

Instantly share code, notes, and snippets.

View phochste's full-sized avatar

Patrick Hochstenbach phochste

View GitHub Profile
use Catmandu;
my $var = '';
my $exporter = Catmandu->exporter('JSON', file => \$var);
$exporter->add({ 'aaargh' => 'doedoedoe' });
$exporter->commit;
print $var;
@phochste
phochste / gist:9d4f2fea85b41de7f563
Created June 17, 2014 15:08
Catmandu ElasticSearch error handler
use Catmandu;
use Data::Dumper;
my $importer = Catmandu->importer('Mock');
# Create a store with a vey strict schema that always produces errors ...
my $store = Catmandu->store('ElasticSearch',
index_name => 'test2',
bags => { data => {
Hello Gwen
How are you!! d sfkhushf s fksuhf ksuhfsalkufhusfkuhkhweuh fkudhauhf ahsdkufs f
slfsdif jslfijsfi jslfijsfijosjfs;ifsij s
@phochste
phochste / gist:4169957
Created November 29, 2012 15:53
Store MARC records in a MongoDB database
use Catmandu::Importer::MARC;
my $importer = Catmandu::Importer::MARC->new(file => "/foo/bar.marc", type=> "USMARC");
my $store = Catmandu::Store::MongoDB->new(database_name => 'test');
$store->bag->add_many($importer);