File-DataClass
view release on metacpan or search on metacpan
lib/File/DataClass/IO.pm view on Meta::CPAN
directory
=head2 canonpath
$canonpath = io( '././path_to_file' )->canonpath;
Returns the canonical path for the object
=head2 catdir
$io = io( 'path_to_directory' )->catdir( 'additional_directory_path' );
Create a new IO directory object by concatenating this objects pathname
with the one that is supplied
=head2 catfile
$io = io( 'path_to_directory' )->catfile( 'additional_file_path' );
Create a new IO file object by concatenating this objects pathname
with the one that is supplied
=head2 child
$io = io( 'path_to_directory' )->child( 'additional_file_path' );
Like L</catdir> and L</catfile> but does not set the object type
=head2 chmod
$io = io( 'path_to_file' )->chmod( '0644' );
Changes the permission on the file to the selected value. Permission values
can be either octal or string
=head2 chomp
$io = io( 'path_to_file' )->chomp;
Causes input lines to be chomped when L</getline> or L</getlines> are called
=head2 chown
$io = io( 'path_to_file' )->chown( $uid, $gid );
Changes user and group ownership
=head2 clear
$io->clear
Set the contents of the internal buffer to the null string
=head2 close
$io->close;
Close the file or directory handle depending on type
If the temporary atomic file exists, renames it to the original
filename. Unlocks the file if it was locked. Closes the file handle
=head2 copy
$dest_obj = io( 'path_to_file' )->copy( $destination_path_or_object );
Copies the file to the destination. The destination can be either a path or
and IO object. Returns the destination object
=head2 cwd
$current_working_directory = io()->cwd;
Returns the current working directory wrapped in a L<File::DataClass::IO>
object
=head2 deep
@files = io( 'path_to_root_of_tree' )->deep->all_files
Changes the default level for the L</all> methods to zero so
that the whole directory tree is searched
=head2 delete
Deletes the atomic update temporary file if it exists. Then calls
L</close>
=head2 delete_tmp_files
$io = io( $tempdir )->delete_tmp_files( $template );
Delete temporary files for this process (temporary file names include
the process id). Temporary files are stored in the C<$tempdir>. Can override
the template filename pattern if required
=head2 digest
$digest_object = io( 'path_to_file' )->digest( $algorithm, $options );
Returns a L<Digest> object which is calculated from the contents of the
specified file. The arguments are optional. The algorithm defaults to
C<SHA-256>. The C<$options> hash reference takes the C<block_size> parameter
which causes the file to read through the buffer C<block_size> bytes at a
time
This was robbed from L<Path::Tiny>
=head2 dir
Initialises the current object as a directory
=head2 dirname
$dirname = io( 'path_to_file' )->dirname;
Returns the L<File::Basename> C<dirname> of the passed path
=head2 empty
$bool = io( 'path_to_file' )->empty;
( run in 2.052 seconds using v1.01-cache-2.11-cpan-140bd7fdf52 )