NAME

Debian::DEP12::ValidationWarning - validaton warning class

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

DESCRIPTION

Debian::DEP12::ValidationWarning is used to store the content of validation warning in a structured way. Currently the class is based on Text::BibTeX::Validate::Warning, but may be decoupled in the future.

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 the index inside list and field for DEP12 field name. Field suggestion is also somewhat special, as Debian::DEP12 may use its value to replace the original in an attempt to clean up the DEP12 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.

AUTHORS

Andrius Merkys, <merkys@cpan.org>