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

Name

Class::Usul::File - File and directory IO base class

Version

0.6.$Revision: 279 $

Synopsis

   package MyBaseClass;

   use base qw(Class::Usul::File);

Description

Provides file and directory methods to the application base class

Subroutines/Methods

absolute

   $absolute_path = $self->absolute( $base, $path );

Prepends $base to $path unless $path is an absolute path

data_dump

   $self->dump( @args );

Accepts either a list or a hash ref. Calls "dataclass_schema" with the storage_class attribute if supplied. Calls the dump method

data_load

   $self->load( @args );

Accepts either a list or a hash ref. Calls "dataclass_schema" with the storage_class and arrays attributes if supplied. Calls the load method

dataclass_schema

   $f_dc_schema_obj = $self->dataclass_schema( $attrs );

Returns a File::DataClass::Schema object. Object uses our exception_class, no caching and no locking by default. Works as a class method

delete_tmp_files

   $self->delete_tmp_files( $dir );

Delete this processes temporary files. Files are in the $dir directory which defaults to $self->tempdir

extensions

   $hash_ref = $self->extensions;

Class method that returns the extensions supported by File::DataClass::Storage

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

   $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

tempdir

   $temporary_directory = $self->tempdir;

Returns $self->config->tempdir or "tmpdir" in File::Spec

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

Class::Usul::Constants
File::DataClass::IO
File::Temp

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) 2013 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