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 - Read, Write file meta-data

VERSION

version 3.0101

SYNOPSIS

    use File::Sticker;

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

DESCRIPTION

This will read and write meta-data from files, in a standardized manner. And update a database with that information.

DEBUGGING

whoami

Used for debugging info

METHODS

new

Create a new object, setting global values for the object.

    my $obj = File::Sticker->new(
        wanted_fields=>\%wanted_fields,
        verbose=>$verbose,
        dbname=>$dbname,
        field_order=>\@fields,
        primary_table=>$primary_table,
        tagfield=>$tagfield,
        derive=>1,
    );

read_meta

This will read the meta-data from the file, using all possible ways.

    my $info = $fs->read_meta(filename=>$filename,read_all=>0);

add_field_to_file

Add the contents of the given field to the file, taking into account multi-value fields.

    $sticker->add_field_to_file(
        filename=>$filename,
        field=>$field,
        value=>$value);

delete_field_from_file

Completely remove the given field. For multi-value fields, it removes ALL the values.

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

replace_all_meta

Overwrite the existing meta-data with that given.

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

query_by_tags

Search using +tag -tag nomenclature.

    $sticker->do_search($query_string);

query_one_file

Get the database info about the given file. This is different from read_meta, since this is getting the info from the database, not from the file.

    $sticker->query_one_file($file);

missing_files

Check through the database to see which files in the database no longer exist.

    my $files = $sticker->missing_files();

overlooked_files

Check through the database to see which of the given files are not in the database.

    my $files = $sticker->overlooked_files(@files);

list_tags

List the faceted-tags from the info table in the database.

    my @tags = @{$sticker->list_tags()};

update_db

Add/Update the given files into the database.

    $sticker->update_db(@files);

delete_file_from_db

Delete the given file from the database.

    $sticker->delete_file_from_db($filename);

derive_values

Derive common values from the existing meta-data.

    $sticker->derive_values(filename=>$filename,
        meta=>$meta);

_get_writer

Pick the appropriate writer for this file

    my $writer = $sticker->_get_writer($filename);

BUGS

Please report any bugs or feature requests to the author.