Catman...:struct(3pm)
π Catman...:struct(3pm) π
ok so bestie, welcome to the manual page for Catmandu::Importer::SRU::Parser::struct β she lives in the Perl user-contributed docs (3pm), and she is exactly the little parser you want when your SRU responses need to become structured XML. sit down, grab a strawberry π, let's get into it.
β¨ NAME β¨
Catmandu::Importer::SRU::Parser::struct β the glow-up that transforms SRU responses into structured XML records. π
π SYNOPSIS π
literally all you do is this:
my $importer = Catmandu::Importer::SRU->new(
base => $base,
query => $query,
parser => 'struct'
);
that's it. parser => 'struct' and she's serving structured records. no cap. β¨
π¦ DESCRIPTION π¦
every single SRU response record gets transformed into order-preserving, structured XML, exactly as defined by XML::Struct. so the order stays put, the structure stays cute, and nothing gets rearranged behind your back. iconic behaviour honestly. π
πΈ CONFIGURATION πΈ
ok so here's the tea β β options of XML::Struct::Reader are not supported here. not me being dramatic, that's just the rules.
but bestie, there's a workaround: if you need them, wrap the reader yourself, like this:
my $reader = XML::Struct::Reader->new( %options );
my $importer = Catmandu::Importer::SRU->new(
base => $base,
query => $query,
parser => sub {
$reader->readDocument(
XML::LibXML::Reader->new( string => $_[0]->{recordData} )
);
},
);
π careful with the details here β theparseris asub, the record data comes from$_[0]->{recordData}, and it's fed intoXML::LibXML::Reader->new( string => ... )before hitting$reader->readDocument(...). copy it exactly, don't freestyle. π
π AUTHOR π
Jakob Voss β "voss@gbv.de" π«Ά
π cute sign-off π
and that's the whole page, bestie! this one's from perl v5.38.2, dated 2021-09-02, and it belongs to the Catman...:struct(3pm) manual. now go forth and parse those SRU responses like the main character you are πβ¨ππ¦πΈπ
π¦ where this page comes from
- ubuntu noble: libcatmandu-sru-perl 0.43.0-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libcatmandu-sru-perl 0.43.0-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libcatmandu-sru-perl 0.43.0-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms