Text::...Warning(3pm)

πŸ’– Text::...Warning(3pm) β€” Text::BibTeX::Validate::Warning πŸ’–

okay bestie, so this page lives in the User Contributed Perl Documentation manual, and it's all about the validaton warning class. yes. we're doing warnings. but like, ✨structured✨ warnings.


🌸 NAME 🌸

Text::BibTeX::Validate::Warning β€” the validaton warning class πŸŽ€


✨ SYNOPSIS ✨

use Text::BibTeX::Validate::Warning;

my $warning = Text::BibTeX::Validate::Warning->new(
    'value \'%(value)s\' is better written as \'%(suggestion)s\'',
    {
        field => 'month',
        value => '1',
        suggestion => 'Jan',
    }
);
print STDERR "$warning\n";

look at her go πŸ˜ŒπŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so like, Text::BibTeX::Validate::Warning is the little container where the content of a validation warning lives β€” the ones emitted by Text::BibTeX::Validate β€” except it stores them in a structured way instead of just being a sad little string. no cap.

and because she's a class with manners, overloads are defined so you can stringify her and compare instances of the class. she's giving main character energy, fr fr. πŸ”₯


πŸ‘‘ METHODS πŸ‘‘

πŸ’œ new( $message, $fields )

okay so this one takes a Text::sprintfn-compatible template and a hash holding the values for replacement in that template. 🫢

and listen β€” three field names are reserved and get used as prefixes for messages if they're defined:

  • file β€” the name of a file πŸ“
  • key β€” the BibTeX key πŸ”‘
  • field β€” the BibTeX field name 🏷️

also, the field suggestion is somewhat special too, because Text::BibTeX::Validate may use its value to replace the original in an attempt to clean up the BibTeX entry. she's a fixer. she's an icon. she's doing the work. πŸ’–


🌈 fields()

returns an array of the fields defined in the instance β€” in any order, so don't come for her about the order, bestie. πŸ™ˆ


πŸ“ get( $field )

returns the value of a field. that's it. that's the method. simple, iconic, ate. ⭐


πŸ’… set( $field, $value )

sets a new value for a field. and then β€” plot twist β€” she returns the old value. 😭 so rude but so useful.


🧚 delete( $field )

unsets the value for a field. and yup, returns the old value too, because she would never leave you without closure. πŸ’œ


🌟 to_string()

return a string representing the warning. literally just that. stringify slay. ✨


πŸŽ€ AUTHORS πŸŽ€

  • Andrius Merkys, <merkys@cpan.org> πŸ‘‘

πŸ’– and that's the whole vibe check, bestie. every flag, every field, every method, nothing skipped, periodt. πŸ¦‹

okay so this lil doc came from perl v5.32.1, dated 2021-02-28, and it lives in the User Contributed Perl Documentation family πŸ’– mwah, go validate some BibTeX, you've got this 🫢✨🌈