The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

File::Sticker::Writer::Xattr - write and standardize meta-data from ExtAttr file

VERSION

version 3.0101

SYNOPSIS

    use File::Sticker::Writer::Xattr;

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

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

DESCRIPTION

This will write meta-data from extended user attributes of 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. Xattr is a low-priority writer.

allowed_file

If this writer can be used for the given file, then this returns true. This can be used with any file, if the filesystem supports extended attributes. I don't know how to test for that, so I'll just assume "yes".

allowed_fields

If this writer can be used for the known and wanted fields, then this returns true. For Xattr, 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. For multi-value fields, it removes ALL the values.

    $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 for multi-value fields.

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

BUGS

Please report any bugs or feature requests to the author.