The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

File::Sticker::Writer::Yaml - write and standardize meta-data from YAML file

VERSION

version 3.0101

SYNOPSIS

    use File::Sticker::Writer::Yaml;

    my $obj = File::Sticker::Writer::Yaml->new(%args);

    my %meta = $obj->write_meta(%args);

DESCRIPTION

This will write meta-data from YAML files, and standardize it to a common nomenclature, such as "tags" for things called tags, or Keywords or Subject etc.

DEBUGGING

whoami

Used for debugging info

METHODS

priority

The priority of this writer. Writers with higher priority get tried first.

allowed_file

If this writer can be used for the given file, then this returns true. File must be plain text and end with '.yml' Howwever, if the file DOES NOT EXIST, it CAN be WRITTEN TO, so return true then as well. This is the only case where the file doesn't need to exist beforehand. Note that if the file exists and is a directory, then it is not an allowed file! If the file exists and is empty, that's okay too.

allowed_fields

If this writer can be used for the known and wanted fields, then this returns true. For YAML, this always returns true.

    if ($writer->allowed_fields())
    {
        ....
    }

known_fields

Returns the fields which this writer knows about. This writer has no limitations.

    my $known_fields = $writer->known_fields();

readonly_fields

Returns the fields which this writer knows about, which can't be overwritten, but are allowed to be "wanted" fields. Things like file-size etc.

    my $readonly_fields = $writer->readonly_fields();

delete_field_from_file

Completely remove the given field. This does no checking for multi-valued fields, it just deletes the whole thing.

    $writer->delete_field_from_file(filename=>$filename,field=>$field);

replace_all_meta

Overwrite the existing meta-data with that given.

(This supercedes the parent method because we can do it more efficiently this way)

    $writer->replace_all_meta(filename=>$filename,meta=>\%meta);

Helper Functions

Private interface.

replace_one_field

Overwrite the given field. This does no checking.

    $writer->replace_one_field(filename=>$filename,field=>$field,value=>$value);

BUGS

Please report any bugs or feature requests to the author.