CBAIS::Actions::Append - append text to a file
$append = new CBAIS::Actions::Append(FILE => '/etc/system', CLASS => 'TestClass');
if ($append->execute())
{
print ``appended data to file /etc/system\n'';
}
if ($append->undo())
{
print ``undo appended data to file /etc/system\n'';
}
The CBAIS::Actions::Append class implements a CBAIS action which appends text to files. Appends are redoable (as long as the file being appended to has a comment character (string) defined). If a file does not exist it is created.
The souce file is searched for using a FileLocator. The default semantics are for a host specific file (suffix specifiers). See the CBAIS::Path::FileLocator manpage for more information.
The constructor. The following hash keys are required to be passed.
The following keys are optional.
char(s)
to use for a comment in the file we are appending to. If not
defined defaults to a ``#''
The following keys are deduced.
Check this action can execute. The existance of the source file is checked, its readability and whether it is a text file.
execute this append.
This method verifies that an append has taken place and the contents of the append file are up to date.
undo an append which has been made to a file. The file is parsed and checked for the append text of aprevious append. If found the text is removed.