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

NAME

File::Atomism::utils - Misc file handling stuff

SYNOPSIS

Utilities for manipulating and creating filenames.

DESCRIPTION

A collection of standard perl functions and utilities for messing with filenames. These are generally useful for manipulating files in an 'atomised' directory, see File::Atomism.

USAGE

Access some values useful for constructing temporary filenames:

   my $hostname = Hostname();
   my $pid = Pid();
   my $unixdate = Unixdate();

Retrieve the inode of a file like so:

    my $inode = Inode ('/path/to/my-house.jpg');

Access the directory and filename given a path:

    Dir ('/path/to/my-house.jpg');
    File ('/path/to/my-house.jpg');

.returns '/path/to/' and 'my-house.jpg' respectively.

Retrieve the file extension (.doc, .txt, .jpg) of a file like so:

    my $extension = Extension ('my-house.jpg');

Ask for a temporary filename like so:

    my $tempname = TempFilename ('/path/to/');
or
    my $tempname = TempFilename ('/path/to/myfile.yml');

A unique filepath based on the directory, hostname, current PID and extension (if supplied, otherwise .tmp will be appended) will be returned:

    /path/to/.foo.example.com-666.tmp
    /path/to/.foo.example.com-666.yml

Ask for a permanent filename like so:

    my $filename = PermFilename ('/path/to/.foo.example.com-666.yml');

A unique filepath based on the hostname, current PID, inode of the temporary file, date and file extension will be supplied:

    /path/to/foo.example.com-666-1234-1095026759.yml

Alternatively you can specify the final extension as a second parameter:

    my $filename = PermFilename ('/path/to/.foo.example.com-666.tmp', 'yml');

Write to the undo buffer like so:

    Journal ([['persistent-file1.yml', '.temp-file1.yml'], [ ... ] ]);

Undo the most recent change to the journal by supplying a directory path to the Undo() method:

    Undo ('/path/to');

Undo the most recent undo() with the Redo() method. Usage is the same as for Undo():

    Redo ('/path/to');