NAME

App::Followme::FolderData - Build metadata from folder information

TODO rewrite

SYNOPSIS

use Cwd;
use App::Followme::FolderData;
my $directory = cwd();
my $data = App::Followme::FolderData->new(directory => $directory);
@filenames = $data->get_files();
foreach my $filename (@filename) {
    print "$filename\n";
}

DESCRIPTION

This module contains the methods that build metadata values that can be computed from properties of the file system, that is, without opening a file or without regard to the type of file. It serves as the base of all the metadata classes that build metadata for specific file types.

METHODS

All data are accessed through the build method.

my %data = $obj->build($name, $filename);

Build a variable's value. The first argument is the name of the variable. The second argument is the name of the file the metadata is being computed for. If it is undefined, the filename in the object is used.

VARIABLES

The folder metadata class can evaluate the following variables. When passing a name to the build method, the sigil should not be used.

@all_files

A list of matching files in a directory and its subdirectories.

@breadcrumbs

A list of breadcrumb filenames, which are the names of the index files above the filename passed as the argument.

@files

A list of matching files in a directory.

@folders

A list of folders under the default folder that contain an index file.

$author

The name of the author of a file

$absolute_url

The absolute url of a web page from a filename.

$date

A date string built from the modification date of the file. The date is built using the template in date_format which contains the fields: weekday, month,day, year, hour, minute, and second.

$mdate

The epoch is modification date of a file in the number of seconds since 1970

$is_current

One if the filename matches the default filename, zero if it does not.

$is_index

One of the filename is an index file and zero if it is not.

$keywords

A list of keywords describing the file from the filename path.

$site_url

The url of the website. Does not have a trailing slash

$title

The title of a file is derived from the file name by removing the filename extension, removing any leading digits,replacing dashes with spaces, and capitalizing the first character of each word.

$url

Build the relative url of a web page from a filename.

CONFIGURATION

The following fields in the configuration file are used in this class and every class based on it:

filename

The filename used to retrieve metatdata from if no filename is passed to the build method.

directory

The directory used to retrieve metadata. This is used by list valued variables.

extension

The extension of the files metadata is retrieved from. This is used by list valued metadata. The default value is the same as the web extension.

date_format

The format used to produce date strings. The format is described in the POD for Time::Format.

sort_field

The metatdata field to sort list valued variables. The default value is the empty string, which means files are sorted on their filenames.

sort_numeric

If one, use numeric comparisons when sorting. If zero, use string comparisons when sorting.

sort_reverse

If this field is 0, the data are sorted the first filename has the smallest metadata value. If the field is 1, it has the largest. The default value of the parameter is 0.

sort_cutoff

This determons the number of filenames returned by @top_files. The default value of this parameter is 5

exclude

The files to exclude when traversing the list of files. Leave as a zero length string if there are no files to exclude.

exclude_dirs

The directories excluded while traversing the list of directories. The default value of this parameter is '.*,_*',

web_extension

The extension used by web pages. This controls which files are returned. The default value is 'html'.

LICENSE

Copyright (C) Bernie Simon.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

Bernie Simon <bernie.simon@gmail.com>