NAME
Perlbug::File - Module for generic file access functions Perlbug.
DESCRIPTION
Simple file access module, handling checking readability, locking and unlocking, etc. transparently for caller
SYNOPSIS
my $o_file = Perlbug::File->new('/tmp/abc.xyz', '+>>', '0755');
$o_file->append("data");
my $a_data = $o_file->read();
print $a_data; # 'other data\nOK\n'
METHODS
- new
-
Create new Perlbug::File object, requires a filename with optional permissions
my $o_file = Perlbug::File->new($file, [['+>>'], '0755']); - error
-
Wrapper for Perlbug::Config->error($error)
$o_file->error($error); - open
-
Open the file, returns self
$o_file = $o_file->open($file, $perm, $num); - handle
-
Get and set handle
my $handle = $o_file->handle; - status
-
Get and set status flag
my $status = $o_file->status; - close
-
Close the file, returns self
$o_file = $o_file->close(); - DESTROY
-
Cleanup open files.
- fh
-
Create a new filehandle
my $fh = $o_file->fh($file, '+>>', 0755); - append
-
Append data to file
my $o_file = $o_file->append('store this stuff'); - read
-
Return the file contents
print $o_file->read(); # array from $fh->getlines -
print the file contents, wrapper for read()
$o_file = $o_file->print(); - truncate
-
Truncate this file
my $o_file = $o_file->truncate(); - copy
-
Copy this to there
@file1_data = $o_file->copy($file1, $file2, '0766'); - create_file
-
Create new file with this data:
$ok = $self->create("$dir/$file.tmp", $data); - link
-
link this to there
$ok = $o_file->link($source, $target, [-f]); - syntax_check
-
Check syntax on given file
$ok = $self->syntax_check("$dir/$file.tmp");
AUTHOR
Richard Foley perlbug@rfi.net Oct 1999 2000 2001