---
name: "Text::BibTeX::Validate::Warning"
section: "3pm"
platform: "linux"
package: "libtext-bibtex-validate-perl"
version: "0.3.0-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Text::BibTeX::Validate::Warning"
---

# Text::BibTeX::Validate::Warning(3pm)

validaton warning class

## 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\>
