X-Git-Url: http://git.rot13.org/?p=perl-cwmp.git;a=blobdiff_plain;f=bin%2Facs.pl;h=cc1a2ad95e5d4bc5f6f725a0d2244ac0ad140b79;hp=6653653edcc09888ae04e98f0cc146923f0c800c;hb=c3e3a10c037b3b0fb7d531d226464e19c9d9e18f;hpb=c65d35f21aa8ffd43d5c993f710cd2d6c377591f diff --git a/bin/acs.pl b/bin/acs.pl index 6653653..cc1a2ad 100755 --- a/bin/acs.pl +++ b/bin/acs.pl @@ -12,25 +12,46 @@ 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; my $store_path = './'; my $store_plugin = 'YAML'; +my $create_dump = 1; GetOptions( 'debug+' => \$debug, 'port=i' => \$port, 'store-path=s' => \$store_path, 'store-plugin=s' => \$store_plugin, + '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, - store => { - module => $store_plugin, - path => $store_path, - debug => $debug, + session => { + store => { + module => $store_plugin, + path => $store_path, + debug => $debug, + }, + create_dump => $create_dump, }, debug => $debug, });