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


Utilities for manipulating and creating filenames.


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.


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/');
    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:


Ask for a permanent filename like so:

    my $filename = PermFilename ('/path/to/');

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


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

    my $filename = PermFilename ('/path/to/', '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');