NAME
CopyTree::VendorProof::LocalFileOp - Perl extension for providing a connecter instance for CopyTree::VendorProof.
This module provides CopyTree::VendorProof a connector instance with methods to deal with local file operations.
SYNOPSIS
use CopyTree::VendorProof::LocalFileOp;
To create a LocalFileOp connector instance:
my $lcfo_inst = CopyTree::VendorProof::LocalFileOp ->new;
To add a source or destination item to a CopyTree::VendorProof instance:
my $ctvp_inst = CopyTree::VendorProof ->new;
$ctvp_inst ->src ('some_source_path_of_local_file_system', $lcfo_inst);
$ctvp_inst ->dst ('some_destination_path_of_local_file_system', $lcfo_inst);
$ctvp_inst ->cp;
DESCRIPTION
CopyTree::VendorProof::LocalFileOp does nothing flashy - it merely provides an instance and local file operation methods for its parent class, CopyTree::VendorProof.
The methods provided in this connector objects include:
new
fdls
is_fd
read_info_memory
write_from_memory
copy_local_files
cust_mkdir
cust_rmdir
cust_rmfile
The functionality of these methods are descripbed in perldoc CopyTree::VendorProof and perldoc CopyTree::VendorProof::LocalFileOp
Instance Methods
Since these are class methods, the first item from @_ is the instance itself, and should be stored in $inst, or whatever you'd like to call it.
0. new
which takes no arguments, but blesses an anonymous hash into the data connection object and returns it
1. fdls
which takes two arguments:
an option ($lsoption) that's one of 'f', 'd', 'fdarrayrefs', or ''
and a directory path $startpath.
The lsoption is passed to the SUPER class fdls_ret, and is not handled at this level.
This method will generate @files and @dirs, which are lists of files and directories that start with $startpath,
And return $self -> SUPER::fdls_ret ($lsoption, \@files, \@dirs),
which is ultimately a listing of the directory content, being one of
@files, @dirs, (\@files, \@dirs), or @files_and_dirs) depending on the options being 'f', 'd', 'fdarrayrefs' or ''
2. is_fd
which takes a single argument of a file or dir $path,
and returns 'd' for directory,
'f' for file,
'pd' for non-existing, but has a valid parent dir,
'0' for non of the above.
3. read_into_memory
which takes the $sourcepath of a file,
and reads (slurps) it into a scalar $binfile #preferably in binmode,
and returns it as \$binfile
4. write_from_memory
which takes the reference to a scalar $binfile (\$binfile) PLUS
a destination path, and writes the scalar to the destination.
no return is necessary
5. copy_local_files
which takes the $source and $destination files on the same file system,
and copies from $source to $destination. No return is necessary. This
method is included such that entirely remote operations may transfer faster,
without an intermediate 'download to local machine' step.
6. cust_mkdir
which takes a $dirpath and creates the dir. If the parent of $dirpah
does not exist, give a warning and do not do anything
7. cust_rmdir
which takes a $dirpath and removes the entire dir tree from $dirpath
croaks / dies if $dirpath is not a dir. No return is necessary.
To make things easier, when writing this method, use
my ($filesref, $dirsref) = $inst -> ls_tree_fdret( $dirpath, $inst -> ls_tree($dirpath);
to get array references of @files and @dirs under $dirpath
Note: ls_tree and ls_tree_fdret uses fdls, and are parent classes in CopyTree::VendorProof
8. cust_rmfile
which takes a $filepath and removes it.
croaks / dies if $file is not a file.
SEE ALSO
CopyTree::VendorProof SharePoint::SOAPHandler
AUTHOR
dbmolester, dbmolester de gmail.com
COPYRIGHT AND LICENSE
Copyright (C) 2011 by dbmolester
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.1 or, at your option, any later version of Perl 5 you may have available.