Martin Owens > Template-Direct-1.16 > Template::Direct::Directory

Download:
Template-Direct-1.16.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 3.02   Source  

NAME ^

Template::Direct::Directory - Controls the access to a set directory

SYNOPSIS ^

  use Directory;

  my $directory = Template::Direct::Directory->new( '/etc' );

  my $file = $directory->open( 'foo.txt' );

  my $parent = $directory->parent();

  my @children = $directory->list();

  my @results = $directory->search();

DESCRIPTION ^

  Loads a directory for use with fileDirectives

METHODS ^

$class->new( $dir )

  Create a new Directory object located at $dir.

$dir->save( $filename, $data, %options )

  Save a file in this directory (quickly)

$dir->loadFile( $filename, %options )

  Load a file object child, options include:

    * Create - Create this file if it doesn't exist

$dir->loadDir( $directory, %options )

  Load a sub directory, options include:

    * Create - Create this file if it doesn't exist

$dir->load( $path, %options )

  Generic load a file or sub directory object with options:

    * Create     - Create this filename as a directory if it doesn't exist
    * CreateFile - Create this filename as a file if it doesn't exist
        * File       - Force loading as a file object.

$dir->delete( $filename, %p )

  Delete a file from this directory.

$dir->_clean_path( %p )

  Takes %p and returns corrected, localised paths.

$dir->clearCache( %p )

  Clear directory and file objects that are cached.

$ir->clearCaches()

  Clear all directory and file objects that are cached.

$dir->fromCache( )

  Was this object loaded from cache (for testing)

$dir->saveCache( $filename, $data )

  Save a cache for filename with data.

$dir->loadCache( $filename )

  Load a specific cache at filename if it exists.

$dir->path( )

  Returns this directories full path.

$dir->name( )

  Returns this folders name.

$dir->mkpath( $directory )

  Create a directory and all parents from this directory.

$dir->prune( $path )

  Removes all empty directories from path to this directory.

<$class>->useElements( $path, $elements )

  Should parts of the path or filename be replaced by a defined hash? (used by load, save, delete)

$dir->exist( %p )

  Does this directory or child exist.

<$dir>->parent( )

  Return a new directory object containing the parent directory.

$dir->list( %p )

  List all directories and files in this directory, load each as an object.

$dir->hlist( )

  Return a clean list of filename children.

$dir->isfile( )

  Returns false

$dir->isdir( )

  Returns true

OVERLOADED ^

$dir->autoeq( $cmp )

  Compare directory location string.

$dir->autone( $cmp )

  Compare directory location string does not equal.

$dir->autoscalar( $cmp )

  Return path of this directory in string context.

$dir->autobool( $cmp )

  Does this directory exist when used in a boolean context.

AUTHOR ^

 Copyright, Martin Owens 2008, AGPL
syntax highlighting: