MAB2::...er::XML(3pm)

πŸ“¦
version 0.24 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu questing

πŸ’– NAME πŸ’–

MAB2::Writer::XML β€” it's the MAB2 XML format serializer, bestie. That's the whole vibe. ✨


🌸 SYNOPSIS 🌸

Okay so MAB2::Writer::XML is a MAB2 XML serializer, periodt. Here's how you pull up:

use MAB2::Writer::XML;

my @mab_records = (
    [
      ['001', ' ', '_', '2415107-5'],
      ['331', ' ', '_', 'Code4Lib journal'],
      ['655', 'e', 'u', 'http://journal.code4lib.org/', 'z', 'kostenfrei'],
      ...
    ],
    {
      record => [
          ['001', ' ', '_', '2415107-5'],
          ['331', ' ', '_', 'Code4Lib journal'],
          ['655', 'e', 'u', 'http://journal.code4lib.org/', 'z', 'kostenfrei'],
          ...
      ]
    }
);

my $writer = MAB2::Writer::XML->new( fh => $fh, xml_declaration => 1, collection => 1 );

$writer->start();

foreach my $record (@mab_records) {
    $writer->write($record);
}

$writer->end();

no cap, that's it. start, write in a loop, end. the holy trinity. πŸ’…


πŸŽ€ Arguments πŸŽ€

  • "xml_declaration" β€” write that XML declaration, queen. Set it to 0 or 1. Default: 0. Optional. πŸ™ˆ
  • "collection" β€” wraps your records in the collection element (<datei>). Set to 0 or 1. Default: 0. Optional. πŸ¦‹
Also go peek at MAB2::Writer::Handle, iykyk. πŸ‘‘

⭐ METHODS ⭐

🌈 new(file => $file | fh => $fh [, xml_declaration => 1, collection => 1, encoding => 'UTF-8'])

Yeah that's the constructor signature, copy it exactly bestie, don't freestyle it. πŸ’–

🌸 start()

Writes the XML declaration and/or the start element for a collection. Main character energy, opening the show. ✨

πŸ¦‹ _write_record()

(it's the internal one, it's giving behind-the-scenes πŸ’…)

πŸ’œ end()

Writes the end element for the collection. Closing the curtain, iconic. πŸŽ€


πŸ’€ SEEALSO

  • MAB2::Writer::Handle
  • Catmandu::Exporter

go read those too, fr fr. πŸ“š


πŸ‘‘ AUTHOR

Johann Rolschewski <jorol@cpan.org> β€” the legend themselves. 🫢


This software is copyright (c) 2013 by Johann Rolschewski.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Slay, open source. πŸ’–


okay bye bestie, this page was generated by perl v5.36.0 on 2022-12-04, and it's part of the User Contributed Perl Documentation collection β€” MAB2::...er::XML(3pm) out. periodt. πŸ’…βœ¨

πŸ“¦ where this page comes from