--- lib/PXElator/file.pm 2009/08/26 08:43:40 290 +++ lib/PXElator/file.pm 2009/08/26 08:59:50 291 @@ -10,8 +10,11 @@ sub mkpath { my $file = shift; - my $dir = $1 if $file =~ s{^.+/[^/]+}{}; - File::Path::mkpath $dir unless -e $dir; + my $dir = $1 if $file =~ s{(^.+)/[^/]+}{$1}; + if ( $dir && ! -d $dir ) { + carp "# mkdir $dir"; + File::Path::mkpath $dir; + } } sub append { @@ -71,11 +74,11 @@ sub copy_once { my ( $from, $to ) = @_; - $to ||= $from; + die "no destination" unless $to; return if -e $to; mkpath $to; - write_file $to, read_file $from; -# warn "# copy_once $to ", -s $to, " bytes"; + carp "# copy_once $from => $to"; + write_file $to, read_file($from); } 1;