NAME
VcsTools::FileAgent - Perl class to handle a file
SYNOPSIS
my $agent = "VcsTools::FileAgent" ;
my $fa = new $agent(name => 'test.txt',
workDir => $ENV{'PWD'}.'/'.$dtest);
$fa->writeFile(content => "dummy content\n", callback => \&got) ;
$fa->readFile(callback => \&got, name => 'test.txt') ;
$fa->stat(callback => \&statcb, name => 'test.txt') ;
DESCRIPTION
This class is used to launch child process pipes. When the process is over, the callback function is called with the content of the STDOUT of the child process.
Constructor
new (name => a_name, workDir => a_dir, [processClass => 'A class name'])
Will create a FileAgent for file 'a_name' in directory 'a_dir'.
When a sub process is necessary to perform a task (for edit() and merge()), FileAgent will create a process handler to handle the sub-process.
By default, the process handler class is VcsTools::Process. If you choose to provide another class, be sure to have the same API as VcsTools::Process.
Methods
edit ('callback' => sub {})
Will run a blocking gnuclient session to edit the file.
merge ('callback' => sub {}, 'input' => a_string )
Will connect to xemacs (with gnudoit) and will run a blocking ediff session. See the ediff documentation.
merge() parameters are :
ancestor: the file name which contains the ancestor of the 2 files to merge
below: the file name which contains one of the revision to merge.
other: the file name which contains the other revision to merge.
callback: the sub to call back when the merge is over.
writeFile (content => string | ref_to_string_array, callback => sub_ref)
Will write content (or a content joined with "\n") into the file.
readFile ( callback => sub_ref)
Will read the content of the file.
getRevision ( callback => sub_ref)
Will read the content of the file and extract the revision number..
stat ( callback => sub_ref)
Will perform a stat (see perlfunc(3)) on the file and pass the stat array to the callback.
chmod ( mode => 0xxx, callback => sub_ref)
Will perform a chmod (see perlfunc(3)) on the file.
remove ( callback => sub_ref)
Will unlink (see perlfunc(3)) the file .
CALLBACK
Callbacks will get 2 parameters :
A boolean result, 1 in case of success, 0 in case of failure.
A string or an array ref of all lines retrieved from the STDOUT.
AUTHOR
Dominique Dumont, Dominique_Dumont@grenoble.hp.com
Copyright (c) 1998 Dominique Dumont. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
SEE ALSO
perl(1), Tk(3), Puppet::Any(3), VcsTools::DataSpec::HpTnd(3), VcsTools::Version(3)
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 154:
You forgot a '=back' before '=head1'