r266@brr: dpavlin | 2007-11-25 19:50:35 +0100
[perl-cwmp.git] / bin / acs.pl
index 3675088..cc1a2ad 100755 (executable)
@@ -12,6 +12,9 @@ use CWMP::Session;
 use CWMP::Vendor;
 use Getopt::Long;
 use Data::Dump qw/dump/;
+use File::Find;
+
+#use Devel::LeakTrace::Fast;
 
 my $port = 3333;
 my $debug = 0;
@@ -27,6 +30,19 @@ GetOptions(
        'create_dump!' => \$create_dump,
 );
 
+if ( $create_dump ) {
+       warn "## cleaning dump directory\n" if $debug;
+       find({
+               wanted => sub {
+                       my $path = $File::Find::name;
+                       return if -d $path;
+                       unlink($path) || die "can't remove $path: $!";
+                       warn "## removed $path\n" if $debug;
+               },
+               no_chdir => 1,
+       }, 'dump/' );
+}
+
 my $server = CWMP::Server->new({
        port => $port,
        session => {