summaryrefslogtreecommitdiff
path: root/Echolot/Tools.pm
diff options
context:
space:
mode:
Diffstat (limited to 'Echolot/Tools.pm')
-rw-r--r--Echolot/Tools.pm17
1 files changed, 16 insertions, 1 deletions
diff --git a/Echolot/Tools.pm b/Echolot/Tools.pm
index 4426b86..fd86a4c 100644
--- a/Echolot/Tools.pm
+++ b/Echolot/Tools.pm
@@ -1,7 +1,7 @@
package Echolot::Tools;
# (c) 2002 Peter Palfrader <peter@palfrader.org>
-# $Id: Tools.pm,v 1.21 2003/02/28 17:10:57 weasel Exp $
+# $Id: Tools.pm,v 1.22 2003/06/06 09:32:37 weasel Exp $
#
=pod
@@ -349,6 +349,21 @@ sub make_garbage() {
return $random;
};
+sub read_file($;$) {
+ my ($name, $fail_ok) = @_;
+
+ unless (open (F, $name)) {
+ Echolot::Log::warn("Could not open '$name': $!.") unless ($fail_ok);
+ return undef;
+ };
+ local $/ = undef;
+ my $result = <F>;
+ close (F);
+
+ return $result;
+};
+
+
1;
# vim: set ts=4 shiftwidth=4: