Name
CatalystX::Usul::File - File and directory IO base class
Version
0.7.$Revision: 1181 $
Synopsis
package MyBaseClass;
use base qw(CatalystX::Usul::File);
Description
Provides file and directory methods to the application base class
Subroutines/Methods
abs_path
$absolute_path = $self->_abs_path( $base, $path );
Prepends $base to $path unless $path is an absolute path
basename
$basename = $self->basename( $path, @suffixes );
Returns the base name of the passed path
catdir
$dir_path = $self->catdir( $part1, $part2 );
Expose "catdir" in File::Spec
catfile
$file_path = $self->catfile( $dir_path, $file_name );
Expose "catfile" in File::Spec
classdir
$dir_path = $self->classdir( __PACKAGE__ );
Returns the path (directory) of a given class. Like "classfile" but without the .pm extenstion
classfile
$file_path = $self->classfile( __PACKAGE__ );
Returns the path (file name plus extension) of a given class. Uses File::Spec for portability, e.g. App::Munchies
becomes App/Munchies.pm
delete_tmp_files
$self->delete_tmp_files( $dir );
Delete this processes temporary files. Files are in the $dir
directory which defaults to $self->tempdir
dirname
$dirname = $self->dirname( $path );
Returns the directory name of the passed path
file_dataclass_schema
$f_dc_schema_obj = $self->file_dataclass_schema( $attrs );
Returns a File::DataClass::Schema object. Object uses our EXCEPTION_CLASS
, no caching and no locking
find_source
$path = $self->find_source( $module_name );
Find the source code for the given module
io
$io_obj = $self->io( $pathname );
Expose the methods in File::DataClass::IO
status_for
$stat_ref = $self->status_for( $path );
Return a hash for the given path containing it's inode status information
symlink
$out_ref = $self->symlink( $base, $from, $to );
Creates a symlink. If either $from
or $to
is a relative path then $base
is prepended to make it absolute. Returns a message indicating success or throws an exception on failure
tempfile
$tempfile_obj = $self->tempfile( $dir );
Returns a File::Temp object in the $dir
directory which defaults to $self->tempdir
. File is automatically deleted if the $tempfile_obj
reference goes out of scope
tempname
$pathname = $self->tempname( $dir );
Returns the pathname of a temporary file in the given directory which defaults to $self->tempdir
. The file will be deleted by "delete_tmp_files" if it is called otherwise it will persist
uuid
$uuid = $self->uuid;
Return the contents of /proc/sys/kernel/random/uuid
Diagnostics
None
Configuration and Environment
None
Dependencies
Incompatibilities
The /uuid
method with only work on a OS with a /proc filesystem
Bugs and Limitations
There are no known bugs in this module. Please report problems to the address below. Patches are welcome
Author
Peter Flanigan, <Support at RoxSoft.co.uk>
License and Copyright
Copyright (c) 2011 Peter Flanigan. All rights reserved
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic
This program is distributed in the hope that it will be useful, but WITHOUT WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE