NAME

App::Followme::FIO - File IO routines used by followme

SYNOPSIS

    use App::Followme::FIO;

DESCRIPTION

This module contains the subroutines followme uses to access the file system

SUBROUTINES

$url = fio_filename_to_url($directory, $filename, $ext);

Convert a filename into a url. The directory is the top directory of the website. The optional extension, if passed, replaces the extension on the file.

$str = fio_flatten($data);

Converted a nested data sructure containing hashes, arrays, and strings to a string by representing hash key value pairs as a colon separated pairs and then joining the pairs with commas and also joining array elements with commas.

$date_string = fio_format_date($date, $format);

Convert a date to a new format. If the format is omitted, the ISO format is used.

$filename = fio_full_file_name(@path);

Construct a filename from a list of path components.

$date = $date = fio_get_date($filename);

Get the modification date of a file as seconds since 1970 (Unix standard.)

$size =fio_get_size($filename);

Get the size of a file in bytes.

$globbed_patterns = fio_glob_patterns($pattern);

Convert a comma separated list of Unix style filename patterns into a reference to an array of Perl regular expressions.

item $test = fio_is_newer($target, @sources);

Compare the modification date of the target file to the modification dates of the source files. If the target file is newer than all of the sources, return 1 (true).

$filename = fio_make_dir($filename);

Make a new directory for a file to live in if the directory does not already exist. Return the filename if the directory already existed or was created and the empty string if the directory could not be created.

$flag = fio_match_patterns($filename, $patterns);

Return 1 (Perl true) if a filename matches a Perl pattern in a list of patterns.

$filename = fio_most_recent_file($directory, $patterns);

Return the most recently modified file in a directory whose name matches a comma separated list of Unix wildcard patterns.

$str = fio_read_page($filename, $binmode);

Read a file into a string. An the entire file is read from a string, there is no line at a time IO. This is because files are typically small and the parsing done is not line oriented. Binmode is an optional parameter that indicates file type if it is not a plain text file.

fio_set_date($filename, $date);

Set the modification date of a file. Date is either in seconds or is in ISO format.

$filename = fio_shorten_path($filename);

Remove dotted directories ('.' and '..') from filename path.

($directory, $filename) = fio_split_filename($filename);

Split an absolute filename into a directory and the filename it contains. If the input filename is a directory, the filename is the empty string.

$filename = fio_to_file($directory, $ext);

Convert a directory name to the index file it contains. The extension is used in the index name. If the directory name is a file name, return it unchnged.

($filenames, $directories) = fio_visit($top_directory);

Return a list of filenames and directories in a directory,

fio_write_page($filename, $str, $binmode);

Write a file from a string. An the entire file is written from a string, there is no line at a time IO. This is because files are typically small. Binmode is an optional parameter that indicates file type if it is not a plain text file.

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>