X-Git-Url: http://git.rot13.org/?p=perl-cwmp.git;a=blobdiff_plain;f=bin%2Facs.pl;h=c524bff9ac45b8987039fd4265fc4c63c3e0fddd;hp=b4b1e8e48f3fde5da97b7a0be5c4e2a04d5dee23;hb=b3f35798ca497b3d02382bfb9f80f97247694e3f;hpb=fec1acf5d1dfce1a661535d2b40b0e9d97de6005 diff --git a/bin/acs.pl b/bin/acs.pl index b4b1e8e..c524bff 100755 --- a/bin/acs.pl +++ b/bin/acs.pl @@ -8,29 +8,52 @@ use strict; use lib './lib'; use CWMP::Server; +use CWMP::Session; 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, }); + $server->run();