summaryrefslogtreecommitdiff
path: root/fml/lib
diff options
context:
space:
mode:
authorfukachan <fukachan>2001-02-01 12:47:42 +0000
committerfukachan <fukachan>2001-02-01 12:47:42 +0000
commitc0b934e1e408f84362ec41cdea5899fa2b0a0ebe (patch)
treef4eaa494d4e2083287a4b81a63109576bfa36692 /fml/lib
parent5c2ac1982cba4bee94de17d63c9399e99143a2bc (diff)
downloadfml8-c0b934e1e408f84362ec41cdea5899fa2b0a0ebe.tar.gz
fml8-c0b934e1e408f84362ec41cdea5899fa2b0a0ebe.tar.bz2
fml8-c0b934e1e408f84362ec41cdea5899fa2b0a0ebe.zip
FML::Utils::copy() is a wrapper, which uses IO::File::Atomic.
Diffstat (limited to 'fml/lib')
-rw-r--r--fml/lib/FML/Utils.pm19
1 files changed, 18 insertions, 1 deletions
diff --git a/fml/lib/FML/Utils.pm b/fml/lib/FML/Utils.pm
index bb356b70..892942e7 100644
--- a/fml/lib/FML/Utils.pm
+++ b/fml/lib/FML/Utils.pm
@@ -16,7 +16,7 @@ use Carp;
require Exporter;
@ISA = qw(Exporter);
-@EXPORT_OK = qw(mkdirhier touch search_program);
+@EXPORT_OK = qw(mkdirhier touch search_program copy);
=head1 NAME
@@ -142,4 +142,21 @@ sub search_program
}
+
+# wrappers for delegation :-)
+sub copy
+{
+ my ($src, $dst) = @_;
+ my $pkg = 'IO::File::Atomic';
+
+ eval qq{ require $pkg; $pkg->import();};
+ unless ($@) {
+ $pkg->new->copy($src, $dst);
+ }
+ else {
+ undef;
+ }
+}
+
+
1;