2001-03-01 06:39:18 +00:00
|
|
|
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.
|
1996-10-24 08:04:19 +00:00
|
|
|
|
2001-03-01 06:39:18 +00:00
|
|
|
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.
|
1996-10-24 08:04:19 +00:00
|
|
|
|
2001-03-01 06:39:18 +00:00
|
|
|
It croaks()s if it can't open the file.
|
1996-10-24 08:04:19 +00:00
|
|
|
|
2001-03-01 06:39:18 +00:00
|
|
|
write_file() creates or overwrites files.
|
1996-10-24 08:04:19 +00:00
|
|
|
|
2001-03-01 06:39:18 +00:00
|
|
|
append_file() appends to a file.
|
1996-10-24 08:04:19 +00:00
|
|
|
|
2001-03-01 06:39:18 +00:00
|
|
|
overwrite_file() does an in-place update of an existing
|
|
|
|
file or creates a new file if it didn't already exist.
|
1996-10-24 08:04:19 +00:00
|
|
|
|
2001-03-01 06:39:18 +00:00
|
|
|
Write_file will also replace a file. The difference is
|
|
|
|
that the first that that write_file() does is to trucate
|
|
|
|
the file whereas the last thing that overwrite_file() is
|
|
|
|
to trucate the file. Overwrite_file() should be used in
|
|
|
|
situations where you have a file that always needs to have
|
|
|
|
contents, even in the middle of an update.
|
1996-10-24 08:04:19 +00:00
|
|
|
|
2001-03-01 06:39:18 +00:00
|
|
|
read_dir() returns all of the entries in a directory
|
|
|
|
except for "." and "..". It croaks if it cannot open the
|
|
|
|
directory.
|