Parse:...:Patch(3pm)

πŸ“¦
version 2.005 Β· 3 versions
, in ubuntu noble, ubuntu resolute, ubuntu stonking

✨ NAME ✨

okay bestie, gather round, because this is Parse::DebControl::Patch πŸ’… and it's literally your new fave thing: easy OO parsing of debian patch file metadata (DEP3) data πŸ¦‹

it's a Perl module, it's from the User Contributed Perl Documentation corner of the (3pm) man pages, and it is so here to make DEP3 headers behave πŸ’–


🌸 SYNOPSIS 🌸

the whole vibe, verbatim, no notes:

use Parse::DebControl::Patch

$parser = new Parse::DebControl::Patch;

$data = $parser->parse_mem($control_data, $options);
$data = $parser->parse_file('./debian/control', $options);
$data = $parser->parse_web($url, $options);

that's it. that's the whole API and she's serving 🫢


πŸ’œ DESCRIPTION πŸ’œ

so like, the patch-file metadata specification (DEP3) is not doing what normal debian/control rules do 😭 β€” it diverts from them, primarly because of the "free-form" field specification. which means: to handle this, we must create a parser specifically for this format and hardcode these rules direclty into the code. no cap. that's the whole strategy and honestly? iconic πŸŽ€

and because we will always only ever have one block of data, we return the hashref directly instead of enclosing it into an array. no unnecessary nesting, we're not doing that here πŸ’…βœ¨

now the star of the show: the field Forwarded is magic πŸͺ„ and it will always exist in the out data, even if it's not specified in the indata. she simply refuses to be absent. it can only have three values:

  • yes
  • no
  • not-needed

and if you don't specify it? it defaults to yes πŸ“

fr fr, do not go looking for Forwarded in your output and being surprised β€” she's always there, bestie πŸ‘‘

Parse::DebControl is copyright 2003,2004 Jay Bonci <jaybonci@cpan.org>.

Parse::DebControl::Patch is copyright 2009 Carl FΓΌrstenberg <azatoth@gmail.com>.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. πŸ“œ


and that's a wrap, gorgeous 🌈 this was page Parse:...:Patch(3pm) from the User Contributed Perl Documentation, running on perl v5.36.0, dated 2022-10-14 β€” go parse some patch metadata and slay πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from