Class::Usul::File - Data loading and dumping
package YourClass; use Class::Usul::File; my $file_obj = Class::Usul::File->new( builder => Class::Usul->new );
Provides data loading and dumping methods, Also temporary file methods and directories instantiated using the Class::Usul::Config object
Defined the following attributes;
config
A required instance of type ConfigProvider
ConfigProvider
lock
A required instance of type Locker
Locker
log
A required instance of type Logger
Logger
BUILDARGS
Extracts the required constructor attributes from the builder attribute if it was supplied
builder
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
$hash_ref = $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
exception_class
delete_tmp_files
$self->delete_tmp_files( $dir );
Delete this processes temporary files. Files are in the $dir directory which defaults to $self->tempdir
$dir
$self->tempdir
tempdir
$temporary_directory = $self->tempdir;
Returns $self->config->tempdir or "tmpdir" in File::Spec
$self->config->tempdir
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
$tempfile_obj
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
None
There are no known incompatibilities in this module
There are no known bugs in this module. Please report problems to the address below. Patches are welcome
Peter Flanigan, <pjfl@cpan.org>
<pjfl@cpan.org>
Copyright (c) 2017 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
To install Class::Usul, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Class::Usul
CPAN shell
perl -MCPAN -e shell install Class::Usul
For more information on module installation, please visit the detailed CPAN module installation guide.