MAB2::...::Disk(3pm)

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

✨ MAB2::...::Disk β€” bestie's guide to the MAB2 Diskette parser ✨

okay so like, quick vibe check: this page is MAB2::...::Disk(3pm) from the User Contributed Perl Documentation, and the star of the show is MAB2::Parser::Disk β€” a parser for MAB2 Diskette records. yes ma'am, that's the whole assignment. πŸ’…


🌸 NAME 🌸

MAB2::Parser::Disk β€” the MAB2 Diskette format parser. that's it, that's the name, iconic behavior honestly.


πŸ¦‹ SYNOPSIS πŸ¦‹

so MAB2::Parser::Disk is a parser for MAB2 Diskette records. periodt.

IMPORTANT bestie: MAB2::Parser::Disk expects UTF-8 encoded files as input. otherwise, hand it a filehandle that already has a specified I/O layer. don't skip that part, she WILL notice. 😭

use MAB2::Parser::Disk;

my $parser = MAB2::Parser::Disk->new( $filename );

while ( my $record_hash = $parser->next() ) {
    # do something
}

πŸŽ€ Arguments πŸŽ€

  • file β€” the path to the file that's holding your MAB2 Diskette records. give her the address, she'll go get it. 🫢
  • fh β€” an open filehandle for the file with MAB2 Diskette records. if you're bringing the filehandle yourself, that's your moment, main character energy. ✨

πŸ‘‘ METHODS πŸ‘‘

🌈 new($filename | $filehandle)

this is how you birth the parser into existence, babes. pass it either a filename or a filehandle β€” your choice, both are valid, we love options here. πŸ’–

🌈 next()

reads the next record from the MAB2 input stream and returns a Perl hash. literal chef's kiss. loop over it like the synopsis shows and you're golden. πŸ”₯

🌈 _decode($record)

deserializes a raw MAB2 record into an ARRAY of ARRAYs. it's giving "unboxing but for data structures." lowkey obsessed. πŸ“¦βœ¨


πŸ”₯ SEE ALSO πŸ”₯

  • Catmandu::Importer::MAB2 β€” go check her out too, iykyk. πŸ’œ

πŸ’– AUTHOR πŸ’–

Johann Rolschewski <jorol@cpan.org> β€” the legend who made this whole thing happen. bow down. πŸ‘‘


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

it's 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 rights fr fr. πŸ¦‹


πŸ’€ no cap, remember the UTF-8 thing. UTF-8 files, or a filehandle with an I/O layer set. that's the whole plot twist.

okay and that's the tea, bestie β€” perl v5.36.0, dated 2022-12-04, straight from the User Contributed Perl Documentation. go parse something cute. πŸ’…πŸŒΈπŸ’–

πŸ“¦ where this page comes from