The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

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'

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',
        }

enc

file encoding for reading and writing files. by default '', which is :raw for PerlIO. you can redefine it by providing supported encoding, as example utf-8 or ascii

layer

PerlIO layer name for reading and writing files. you can redefine it by providing argument

part

chunk size for file reading, storing and moving

move

moving file to another path

type

always 'file'

touch

similar to unix touch command - updates file timestamp

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.