|
IO::File::String - load/save whole file as single string |
IO::File::String - load/save whole file as single string
Simple interface to enable load/save the whole file as single scalar string.
It is subclass of IO::File so that all methods are inherited (including the 'new' method).
my $sfh = IO::File::String->new( '< my-file.txt' ); $sfh->load( my $str )->close; ... my $str = 'test string'; my $sfh = IO::File::String->new( '> my-file.txt' ); $sfh->save( $str )->close;
=cut
#------------------------------------------------------ # 2004/01/09 - $Date: 2004/01/09 18:31:44 $ # (C) Daniel Peder & Infoset s.r.o., all rights reserved # http://www.infoset.com, Daniel.Peder@infoset.com #------------------------------------------------------ # $Revision: 1.3 $ # $Date: 2004/01/09 18:31:44 $ # $Id: String.pm_rev 1.3 2004/01/09 18:31:44 root Exp root $
# --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- # # SECTION: package #
package IO::File::String;
# --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- # # SECTION: version #
$IO::File::String::VERSION = '0.11';
# --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- # # SECTION: modules use #
require 5.005_62;
use IO::File ;
use base qw( IO::File );
# --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- # # SECTION: methods #
$fh->load( my $string );
Load the whole file into $string.
$fh->save( $string );
Save the whole $string into file.
none
project started: 2004/01/09 >
$Id: String.pm_rev 1.3 2004/01/09 18:31:44 root Exp root $
Daniel Peder, Daniel.Peder@Infoset.COM
http://www.Infoset.COM
the IO::File manpage the IO::Handle manpage the IO::Seekable manpage
'Out of memory' could occur on large files because the whole file is allways tried to put in memory without size checking.
=cut
__DATA__
__END__
|
IO::File::String - load/save whole file as single string |