NAME
IO::Easy::File - IO::Easy child class for operations with files.
METHODS
contents, path, extension, dir_path
my $io = IO::Easy->new ('.');
my $file = $io->append('example.txt')->as_file;
print $file->contents; # prints file content
print $file->path; # prints file path, in this example it's './example.txt'
print $file->extension; # file extension, in this example it's 'txt'
print $file->dir_path; # parent directory, './'
store, store_if_empty
IO::Easy::File has 2 methods for saving file: store and store_if_empty
my $io = IO::Easy->new ('.');
my $file = $io->append('example.txt')->as_file;
my $content = "Some text goes here";
$file->store($content); # saves the variable $content to file
$file->store_if_empty($content); # saves the variable $content to file, only
# if there's no such a file existing.
string_reader
read strings from file in normal or reverse order
$io->string_reader (sub {
my $s = shift;
print $s;
});
read from file end
$io->string_reader (sub {
my $s = shift;
print $s;
}, reverse => 1);
__data__files
parse __DATA__ section and return hash of file contents encoded as:
__DATA__
########################
# IO::Easy file1
########################
FILE1 CONTENTS
########################
# IO::Easy file2
########################
FILE2 CONTENTS
returns
{
file1 => 'FILE1 CONTENTS',
file2 => 'FILE2 CONTENTS',
}
AUTHOR
Ivan Baktsheev, <apla at the-singlers.us>
BUGS
Please report any bugs or feature requests to my email address, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=IO-Easy. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
ACKNOWLEDGEMENTS
COPYRIGHT & LICENSE
Copyright 2007-2009 Ivan Baktsheev
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.