Debian...arning(3pm)

πŸ“¦
version 0.2.0 Β· 5 versions
, in ubuntu resolute, ubuntu stonking

πŸ’– Debian::DEP12::ValidationWarning(3pm) β€” bestie edition πŸ’–

okay so this is a page from the User Contributed Perl Documentation section, and the star of the show is Debian::DEP12::ValidationWarning, a lil class that holds onto your validation warnings like a notes-app girlie who never loses a receipt. let's get into it πŸŽ€


✨ NAME ✨

Debian::DEP12::ValidationWarning β€” the validation warning class. yes bestie, it's giving "structured complaint" energy and we love her for it πŸ’…


✨ SYNOPSIS ✨

use Debian::DEP12::ValidationWarning;

my $warning = Debian::DEP12::ValidationWarning->new(
    'value \'%(value)s\' is better written as \'%(suggestion)s\'',
    {
        field => 'Bug-Submit',
        value => 'merkys@cpan.org',
        suggestion => 'mailto:merkys@cpan.org',
    }
);
print STDERR "$warning\n";

look at her go πŸ¦‹ you build one, you print it to STDERR, done. no cap.


✨ DESCRIPTION ✨

Debian::DEP12::ValidationWarning exists so a validation warning's content can be stored in a structured way instead of just vibing as a loose string. and ngl, right now the class is built on top of Text::BibTeX::Validate::Warning β€” but she might get decoupled in the future, so don't get too attached to that ancestry, iykyk πŸ‘‘


✨ METHODS ✨

🌸 new( $message, $fields )

takes a Text::sprintfn-compatible template plus a hash holding the values you wanna swap into that template. classic.

now here's the tea: three field names are reserved and get used as message prefixes if they're defined:

  • file β€” the name of a file
  • key β€” the index inside a list
  • field β€” the DEP12 field name

and one more that's a lil special: suggestion. Debian::DEP12 might use its value to replace the original, in an attempt to clean up the DEP12 entry. so she's not just decorative, she's got a job πŸ’…

🌸 fields()

returns an array of the fields defined in the instance β€” in any order, so don't come for her about sorting 🫢

🌸 get( $field )

returns the value of a field. simple. iconic.

🌸 set( $field, $value )

sets a new value for a field, and returns the old value. so you always get the receipts back 🧾✨

🌸 delete( $field )

unsets the value for a field, and also returns the old value. bye bestie, but here's what you were πŸ‘‹


✨ AUTHORS ✨

Andrius Merkys, <merkys@cpan.org> πŸ’œ


heads up bestie: the suggestion field isn't just any old key β€” Debian::DEP12 may use it to replace the original while cleaning up the DEP12 entry, so treat it with main character respect πŸ‘‘

and that's the whole page, fr fr 🌈 this was rendered by perl v5.40.0 on 2024-09-28, so go forth and validate, you absolute queen πŸ‘‘πŸ’–

πŸ“¦ where this page comes from