NAME
SysAdmin::File - Perl IO::File wrapper module..
SYNOPSIS
my $file_object = new SysAdmin::File( name => "/tmp/test.txt" );
my $array_ref = $file_object ->readFile();
foreach my $row ( @$array_ref ){
print "Row $row\n" ;
}
my @file_contents = ( "First Line" , "Second Line" );
$file_object ->writeFile(\ @file_contents );
my @file_contents_append = ( "Third Line" , "Fourth Line" );
$file_object ->appendFile(\ @file_contents_append );
my $file_exist = $file_object ->fileExist();
if ( $file_exist ){
print "File exists\n" ;
}
my $directory_object = new SysAdmin::File( name => "/tmp" );
my $directory_exist = $directory_object ->directoryExist();
if ( $directory_exist ){
print "Directory exists\n" ;
}
|
DESCRIPTION
This is a sub class of SysAdmin. It was created to harness Perl Objects and keep code abstraction to a minimum.
SysAdmin::File uses IO::File to interact with files.
METHODS
new()
my $file_object = new SysAdmin::File( name => "/tmp/test.txt" );
|
readFile()
my $array_ref = $file_object ->readFile();
foreach my $row ( @$array_ref ){
print "Row $row\n" ;
}
|
writeFile()
my @file_contents = ( "First Line" , "Second Line" );
$file_object ->writeFile(\ @file_contents );
|
appendFile()
my @file_contents_append = ( "Third Line" , "Fourth Line" );
$file_object ->appendFile(\ @file_contents_append );
|
fileExist()
my $file_exist = $file_object ->fileExist();
|
directoryExist()
my $directory_object = new SysAdmin::File( name => "/tmp" );
my $directory_exist = $directory_object ->directoryExist();
if ( $directory_exist ){
print "Directory exists\n" ;
}
|
SEE ALSO
IO::File - supply object methods for filehandles
AUTHOR
Miguel A. Rivera
COPYRIGHT AND LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.