| Perlbug documentation | view source | Contained in the Perlbug distribution. |
Perlbug::File - Module for generic file access functions Perlbug.
Simple file access module, handling checking readability, locking and unlocking, etc. transparently for caller
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'
Create new Perlbug::File object, requires a filename with optional permissions
my $o_file = Perlbug::File->new($file, [['+>>'], '0755']);
Wrapper for Perlbug::Config->error($error)
$o_file->error($error);
Open the file, returns self
$o_file = $o_file->open($file, $perm, $num);
Get and set handle
my $handle = $o_file->handle;
Get and set status flag
my $status = $o_file->status;
Close the file, returns self
$o_file = $o_file->close();
Cleanup open files.
Create a new filehandle
my $fh = $o_file->fh($file, '+>>', 0755);
Append data to file
my $o_file = $o_file->append('store this stuff');
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 this file
my $o_file = $o_file->truncate();
Copy this to there
@file1_data = $o_file->copy($file1, $file2, '0766');
Create new file with this data:
$ok = $self->create("$dir/$file.tmp", $data);
link this to there
$ok = $o_file->link($source, $target, [-f]);
Check syntax on given file
$ok = $self->syntax_check("$dir/$file.tmp");
Richard Foley perlbug@rfi.net Oct 1999 2000 2001
| Perlbug documentation | view source | Contained in the Perlbug distribution. |