summaryrefslogtreecommitdiff
path: root/fml/lib/File/Utils.pm
diff options
context:
space:
mode:
authorfukachan <fukachan>2002-04-24 03:47:51 +0000
committerfukachan <fukachan>2002-04-24 03:47:51 +0000
commitb8392bab4074ab4a4dbb8b0c27103ae45197c2c4 (patch)
tree163382e53edbe52ecc05a98ea7dde4e5154f739e /fml/lib/File/Utils.pm
parentc8ede67c9aa0819e2ea9873e861663dfeb929b25 (diff)
downloadfml8-b8392bab4074ab4a4dbb8b0c27103ae45197c2c4.tar.gz
fml8-b8392bab4074ab4a4dbb8b0c27103ae45197c2c4.tar.bz2
fml8-b8392bab4074ab4a4dbb8b0c27103ae45197c2c4.zip
define append()
Diffstat (limited to 'fml/lib/File/Utils.pm')
-rw-r--r--fml/lib/File/Utils.pm37
1 files changed, 35 insertions, 2 deletions
diff --git a/fml/lib/File/Utils.pm b/fml/lib/File/Utils.pm
index 33485c20..65d6f86d 100644
--- a/fml/lib/File/Utils.pm
+++ b/fml/lib/File/Utils.pm
@@ -4,7 +4,7 @@
# All rights reserved. This program is free software; you can
# redistribute it and/or modify it under the same terms as Perl itself.
#
-# $FML: Utils.pm,v 1.11 2002/01/13 13:35:25 fukachan Exp $
+# $FML: Utils.pm,v 1.12 2002/04/08 12:44:26 fukachan Exp $
#
package File::Utils;
@@ -15,7 +15,7 @@ use Carp;
require Exporter;
@ISA = qw(Exporter);
-@EXPORT_OK = qw(mkdirhier touch search_program copy);
+@EXPORT_OK = qw(mkdirhier touch search_program copy append);
=head1 NAME
@@ -208,6 +208,39 @@ sub copy
}
+=head2 append($src, $dst)
+
+append content in file $src into file $dst.
+
+=cut
+
+
+# Descriptions: append $src into $dst
+# Arguments: STR($src) STR($dst)
+# Side Effects: create $dst if needed
+# Return Value: none
+sub append
+{
+ my ($src, $dst) = @_;
+
+ use FileHandle;
+ my $rh = new FileHandle $src;
+ my $wh = new FileHandle ">> $dst";
+
+ if (defined($rh) && defined($wh)) {
+ while (<$rh>) {
+ print $wh $_;
+ }
+ $wh->close();
+ $rh->close();
+ }
+ else {
+ croak("fail to open $src") unless defined $rh;
+ croak("fail to open $dst") unless defined $wh;
+ }
+}
+
+
=head1 AUTHOR
Ken'ichi Fukamachi