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

NAME

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

SYNOPSIS

    use Cwd;
    use App::Followme::FolderData;
    my $directory = getcwd();
    my $data = App::Followme::FolderData->new();
    my $filenames = $data->get_files($directory);
    foreach my $filename (@$filenames) {
        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.

@top_files

A list of the most recently created files in a directory and its subdirectory. The length of the list is determined by the configuration parameter list_length.

@breadcrumbs

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

@related_files

A list of files with the same file root name as a specified file. This list is not filtered by the configuration variables extension and exclude.

@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 creation 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

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.

$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.

$remote_url

The remote url of a web page from a filename.

$site_url

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

$index_url

The url of the index page in the same folder as a file.

$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.

$url_base

Build the relative url of a filename minus any extension and trailing dot

$extension

The extension of a filename.

$url_next

Build the relative url of a web page from the next filename in the loop sequence. Empty string if there is no next filename.

$url_previous

Build the relative url of a web page from the previous filename in the loop sequence. Empty string if there is no previous 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

A comma separated list of extensions of files to include in a list of files. If it is left empty, it is set to the web extension.

date_format

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

remote_url

The url of the remote website, e.g. http://www.cloudhost.com.

site_url

The url of the local website, e.g. http://www.example.com.

sort_numeric

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

exclude_index

If the value of this variable is true (1) exclude the index page in the list of files. If it is false (0) include the index page. The default value is 0.

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>