logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Text::BibTeX::Validate::Warning - validaton warning class

Authors

       Andrius Merkys, <merkys@cpan.org>

perl v5.32.1                                       2021-02-28               Text::BibTeX::Validate::Warning(3pm)

Description

       Text::BibTeX::Validate::Warning is used to store the content of validation warning (as emitted by
       Text::BibTeX::Validate) in a structured way.  Overloads are defined to stringify and to compare instances
       of the class.

Methods

new($message,$fields)
       Takes Text::sprintfn-compatible template and a hash with the values for replacement in the template.
       Three field names are reserved and used as prefixes for messages if defined: "file" for the name of a
       file, "key" for BibTeX key and "field" for BibTeX field name. Field "suggestion" is also somewhat
       special, as Text::BibTeX::Validate may use its value to replace the original in an attempt to clean up
       the BibTeX entry.

   fields()
       Returns an array of fields defined in the instance in any order.

   get($field)
       Returns value of a field.

   set($field,$value)
       Sets a new value for a field. Returns the old value.

   delete($field)
       Unsets value for a field. Returns the old value.

   to_string()
       Return a string representing the warning.

Name

       Text::BibTeX::Validate::Warning - 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";

See Also