#!usr/bin/perl #******************************************************************* package fileoprn ; =FUNCTION ======================================================================== FILEREAD ================= ----------------------------------------------------------------- Parameter : File path Return Value : The file buffer ==================================================================== =cut sub fileread($) { my($filepath) = @_; my $filebuf; chomp($filepath); open(FIN,"< $filepath") || open(FIN,"< $filepath") || warn "Unable to open file : $filepath"; $filebuf = join '', ; close(FIN); return $filebuf; } =FUNCTION ======================================================================== FILEWRITE ================= ----------------------------------------------------------------- Parameter : File path, buffer Return Value : ==================================================================== =cut sub filewrite($$) { my($filepath,$filebuf) = @_; chomp($filepath); open(FOUT,"> $filepath") || die "Unable to open file : $filepath"; print FOUT $filebuf; close(FOUT); } =FUNCTION ======================================================================== FILEAPPEND ================= ----------------------------------------------------------------- Parameter : File path, buffer Return Value : ==================================================================== =cut sub fileappend($$) { my($filepath,$filebuf) = @_; chomp($filepath); open(FOUT,">> $filepath") || die "Unable to open file : $filepath"; print FOUT $filebuf; close(FOUT); } 1