The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

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.           

create

creates new directory

        my $io = IO::Easy->new ('.');
        my $dir = $io->append('data')->as_dir;  # appends 'data' to $io and returns 
                                                                                        #the new object; blesses into directory object.
        $dir->create;                                                   # creates directory './data/'

or

        $io->as_dir->create ('data');

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.