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";

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.

AUTHORS

Andrius Merkys, <merkys@cpan.org>