diff options
| author | fukachan <fukachan> | 2001-02-01 12:47:42 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2001-02-01 12:47:42 +0000 |
| commit | c0b934e1e408f84362ec41cdea5899fa2b0a0ebe (patch) | |
| tree | f4eaa494d4e2083287a4b81a63109576bfa36692 /fml/lib | |
| parent | 5c2ac1982cba4bee94de17d63c9399e99143a2bc (diff) | |
| download | fml8-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.pm | 19 |
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; |
