NAME

Remember::Anything::AsPath - remember objects seen by a specific created id in a folder structure

VERSION

version 0.01

SYNOPSIS

use Remember::Anything::AsPath;

my $book = {
    url   => 'www.books.de/3',
    name  => 'I <3 perl',
    price => 999,
};

my $brain = Remember::Anything::AsPath->new(
    tree_depth => $some_int # 1, only file directly, 2 one folder then file ....
                            # default is 2
    digest_sub => sub {
        # return pathfriendly checksum of string
        # on default this is sha1_hex
    },
    out_dir => 'where/to/start/with/tree' # default '.'
);

# remember $book object in
$brain->remember($book);

if ($brain->seen($another_book) {
    # discard? ...
}
else {
    # save
    push @books, $another_book;
}

DESCRIPTION

Remember $anything in a tree of folders and empty files.

METHODS

remember

$brain->remember($anything);

Remember $antything in the filesystem. $anything will be hashed and saved in a tree of folders and one empty file.

Example for tree_depth of 2:

$anything -> $hashed_id -> out_dir/$id_part_1/$id_part_2/$id_part_3

seen

$brain->seen($anything);

Checks if there is an existing file path for the hashed id of $anything. If $anything has been remembered before it will return 1, otherwise 0.

ACKNOWLEDGEMENTS

ac0vs dirty and beautiful way of avoiding a database.

LICENSE

This is released under the Artistic License.

AUTHOR

spebern <bernhard@specht.net>