From 31b85341631ecc82030e9e72bd9a9d6efb30ee21 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Fri, 25 Nov 2011 13:58:23 +0100 Subject: [PATCH] remote_tree for directory deletion --- gearman/send_file.pl | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/gearman/send_file.pl b/gearman/send_file.pl index a179607..68304e5 100755 --- a/gearman/send_file.pl +++ b/gearman/send_file.pl @@ -3,7 +3,7 @@ use warnings; use strict; use Data::Dump qw(dump); -use File::Path qw(make_path); +use File::Path qw(make_path remove_tree); sub home_dir { my $login = shift; @@ -48,11 +48,16 @@ $worker->register_function( delete => sub { my $full = $dir . $work; if ( -d $full ) { - warn "rmdir $full\n"; - rmdir $full || warn "ERROR $!"; + warn "remove_tree $full\n"; + remove_tree $full; } else { warn "unlink $full\n"; - unlink $full || warn "ERROR $!"; + } + if ( $! ) { + warn "ERROR: $!"; + return "$full: $!\n"; + } else { + return "$full: OK\n"; } }); -- 2.20.1