home *** CD-ROM | disk | FTP | other *** search
-
- <HTML>
- <HEAD>
- <TITLE>File::Slurp -- single call read & write file routines; read directories</TITLE>
- <LINK REL="stylesheet" HREF="../../../Active.css" TYPE="text/css">
- <LINK REV="made" HREF="mailto:">
- </HEAD>
-
- <BODY>
- <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
- <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
- <STRONG><P CLASS=block> File::Slurp -- single call read & write file routines; read directories</P></STRONG>
- </TD></TR>
- </TABLE>
-
- <A NAME="__index__"></A>
- <!-- INDEX BEGIN -->
-
- <UL>
-
- <LI><A HREF="#name">NAME</A></LI><LI><A HREF="#supportedplatforms">SUPPORTED PLATFORMS</A></LI>
-
- <LI><A HREF="#synopsis">SYNOPSIS</A></LI>
- <LI><A HREF="#description">DESCRIPTION</A></LI>
- <LI><A HREF="#author">AUTHOR</A></LI>
- </UL>
- <!-- INDEX END -->
-
- <HR>
- <P>
- <H1><A NAME="name">NAME</A></H1>
- <PRE>
- File::Slurp -- single call read & write file routines; read directories</PRE>
- <P>
- <HR>
- <H1><A NAME="supportedplatforms">SUPPORTED PLATFORMS</A></H1>
- <UL>
- <LI>Windows</LI>
- </UL>
- <HR>
- <H1><A NAME="synopsis">SYNOPSIS</A></H1>
- <PRE>
- use File::Slurp;</PRE>
- <PRE>
- $all_of_it = read_file($filename);
- @all_lines = read_file($filename);</PRE>
- <PRE>
- write_file($filename, @contents)</PRE>
- <PRE>
- overwrite_file($filename, @new_contnts);</PRE>
- <PRE>
- append_file($filename, @additional_contents);</PRE>
- <PRE>
- @files = read_dir($directory);</PRE>
- <P>
- <HR>
- <H1><A NAME="description">DESCRIPTION</A></H1>
- <P>These are quickie routines that are meant to save a couple of lines of
- code over and over again. They do not do anything fancy.
- </P>
- <PRE>
-
- read_file() does what you would expect. If you are using its output
- in array context, then it returns an array of lines. If you are calling
- it from scalar context, then returns the entire file in a single string.</PRE>
- <P>It croaks()s if it can't open the file.</P>
- <P><CODE>write_file()</CODE> creates or overwrites files.</P>
- <P><CODE>append_file()</CODE> appends to a file.</P>
- <P><CODE>overwrite_file()</CODE> does an in-place update of an existing file or creates
- a new file if it didn't already exist. Write_file will also replace a
- file. The difference is that the first that that <CODE>write_file()</CODE> does is
- to trucate the file whereas the last thing that <CODE>overwrite_file()</CODE> is to
- trucate the file. <CODE>Overwrite_file()</CODE> should be used in situations where
- you have a file that always needs to have contents, even in the middle
- of an update.</P>
- <P><CODE>read_dir()</CODE> returns all of the entries in a directory except for ``.''
- and ``..''. It croaks if it cannot open the directory.</P>
- <P>
- <HR>
- <H1><A NAME="author">AUTHOR</A></H1>
- <P>David Muir Sharnoff <<A HREF="mailto:muir@idiom.com">muir@idiom.com</A>></P>
- <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
- <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
- <STRONG><P CLASS=block> File::Slurp -- single call read & write file routines; read directories</P></STRONG>
- </TD></TR>
- </TABLE>
-
- </BODY>
-
- </HTML>
-