From 344caca0b017590a9a3770a634841892a2c82cb2 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Tue, 20 Nov 2007 13:09:08 +0000 Subject: [PATCH] r248@brr: dpavlin | 2007-11-20 14:08:48 +0100 cleanup dump directory on startup git-svn-id: https://perl-cwmp.googlecode.com/svn/trunk@217 836a5e1a-633d-0410-964b-294494ad4392 --- Makefile.PL | 1 + bin/acs.pl | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/Makefile.PL b/Makefile.PL index b317c5f..723073d 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -26,6 +26,7 @@ requires 'IPC::DirQueue'; requires 'File::Spec'; requires 'File::Path'; requires 'Class::Trigger'; +requires 'File::Find'; build_requires 'Test::More'; diff --git a/bin/acs.pl b/bin/acs.pl index 3675088..1b341e7 100755 --- a/bin/acs.pl +++ b/bin/acs.pl @@ -12,6 +12,7 @@ use CWMP::Session; use CWMP::Vendor; use Getopt::Long; use Data::Dump qw/dump/; +use File::Find; my $port = 3333; my $debug = 0; @@ -27,6 +28,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 => { -- 2.20.1