CopyTree-VendorProof

 view release on metacpan or  search on metacpan

lib/CopyTree/VendorProof.pm  view on Meta::CPAN


=head2 cp

	$ctvp_inst ->cp;

starts copy operation based on the $ctvp_inst->src and $ctvp_inst->dst that's initiated

=head2 copy_meth_deci

internal method - if source and destination are using the same object (for example, both on sharepoint), do not use the local memory as an intermediate data cache

=head2 ls_tree

	$ctvp_inst ->ls_tree($path)

returns a hash ref of the tree structure under $path, which files are undef, and dirs are references to yet another anonymous hash

=head2 ls_tree_fdret 
	
	$ctvp_inst->($root_path_name, $hashref)

takes a $root_path_name and the $hashref returned from a previous $ctvp->ls_tree and returns (\@files, \@dirs) with the $root_path_name added on as the parent of these @files and @dirs

=head2 path

This is not used by the VendorProof instance.  Instead, it provides a base class for connector instances to use to set a $path variable.  Not really used and not extensively tested.

=head2 fdls_ret

This method is provided as a base class for connector instances to use.  It provides common code for fdls methods from different connector objects.
	
Of the aforementioned methods, new, path, and reset are the only methods that do not require additional connector objects to function, although path has the sole function of providing a base class to connector objects.


=head1 Object specific instance methods for the base class CopyTree::VendorProof

Before you start involking CopyTree::VendorProof ->new, you'd better set up class instances for your source(s) and destination.  These class instances will provide class specific methods for file operations, which CopyTree::VendorProof relies on to c...

=head2 0. new

which takes no arguments, but blesses an anonymous hash into the data connection object and returns it.  If you're using Moose, it won't allow you to overwrite / redefine the new that's in the parent class, but that's okay. Use the parent class's new...

=cut

=head2 1. fdls

which takes two arguments:

=over

=item *

$lsoption that's one of 'f', 'd', 'fdarrayrefs', or '', and

a directory path $startpath.

=back

The lsoption is passed to the SUPER class fdls_ret, and is not handled at this level.  

The $startpath should be standardized to start in a certain 'root' directory; for example, in SharePoint::SOAPHandler, it must start with "Shared Documents", and in Livelink::DAV, it must start with a dir right under the webdav root folder.  Spaces a...

This method will generate @files and @dirs, which are lists of files and directories that start with $startpath, And returns 
	
	$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 ''

For example, if you have a tree structure:

	/home/
	/home/john
	/home/john/notes.txt
	/home/john/punch.mov
	/home/john/picutres
	/home/john/pictures/1.jpg

and your $startdir is /home/john, and your $lsoption is 'f':
You will create

	@files, which is ("/home/john/notes.txt", "/home/john/punch.mov")
	@dirs, which consist of ("/home/john/pictures")

And, the last line of your method (subroutine) will be

	return $self->SUPER::fdls_ret($lsoption, \@files, \@dirs);

=over

=item *

note, if you use Moose, simply return

	$self -> fdls_ret ($lsoption, \@files, \@dirs)

but remember to include an 'extends' statement for the base class:

	extends CopyTree::VendorProof;

=back

=cut 

=head2 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.

This code will vary by connector modules; most connectors have file test facilities to return 'f' or 'd', but most connectors we have to custom code the 'pd' test.  For connectors that can't tell 'f' or 'd' directly, we have to be creative and do a d...

=head2 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

=head2 4. write_from_memory

which takes the reference to a scalar $binfile (\$binfile)  PLUS a destination path, and writes the scalar to the destination.  Do a is_fd check on destination, and perform no action if the destination exists as directory (base class handles that).  ...



( run in 2.716 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )