cleanup dump directory on startup
git-svn-id: https://perl-cwmp.googlecode.com/svn/trunk@217
836a5e1a-633d-0410-964b-
294494ad4392
requires 'File::Spec';
requires 'File::Path';
requires 'Class::Trigger';
requires 'File::Spec';
requires 'File::Path';
requires 'Class::Trigger';
build_requires 'Test::More';
build_requires 'Test::More';
use CWMP::Vendor;
use Getopt::Long;
use Data::Dump qw/dump/;
use CWMP::Vendor;
use Getopt::Long;
use Data::Dump qw/dump/;
my $port = 3333;
my $debug = 0;
my $port = 3333;
my $debug = 0;
'create_dump!' => \$create_dump,
);
'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 => {
my $server = CWMP::Server->new({
port => $port,
session => {