diff options
author | mark <mark> | 2011-03-01 04:38:31 +0000 |
---|---|---|
committer | mark <mark> | 2011-03-01 04:38:31 +0000 |
commit | 6f0d2394d35b47761f54991895cdf40c4e6bcc16 (patch) | |
tree | cb0c7ab262f2974a1fcc5529b4d8c11547a5747c /FS/FS/part_export/voipnow_did.pm | |
parent | e3a2ca0a7ef6e0931283136321ba8c1494b37c19 (diff) |
VoipNow export, minor fixes
Diffstat (limited to 'FS/FS/part_export/voipnow_did.pm')
-rw-r--r-- | FS/FS/part_export/voipnow_did.pm | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/FS/FS/part_export/voipnow_did.pm b/FS/FS/part_export/voipnow_did.pm index cd13a44..514db8d 100644 --- a/FS/FS/part_export/voipnow_did.pm +++ b/FS/FS/part_export/voipnow_did.pm @@ -5,7 +5,6 @@ use Tie::IxHash; use FS::Record qw(qsearch qsearchs dbh); use FS::part_export; use FS::areacode; -use XML::Writer; use XML::Simple 'XMLin'; use Net::SSLeay 'post_https'; use Cache::FileCache; @@ -19,6 +18,7 @@ tie my %options, 'Tie::IxHash', 'login' => { label=>'VoipNow client login' }, 'password' => { label=>'VoipNow client password' }, 'country' => { label=>'Country (two-letter code)' }, + 'cache_time' => { label=>'Cache lifetime (seconds)' }, ; %info = ( @@ -38,7 +38,8 @@ sub did_cache { my $self = shift; $CACHE ||= new Cache::FileCache( { 'namespace' => __PACKAGE__, - 'default_expires_in' => 300, + 'default_expires_in' => $self->option('cache_time') || 300, + 'cache_root' => $FS::UID::cache_dir.'/cache'.$FS::UID::datasrc, } ); return $CACHE->get($self->exportnum) || $self->reload_cache; } @@ -259,6 +260,9 @@ sub voipnow_command { my $host = $self->machine; my $path = "/soap2/${endpoint}_agent.php"; + eval "use XML::Writer"; + die $@ if $@; + warn "[$method] constructing request\n" if $DEBUG; my $soap_request; my $writer = XML::Writer->new( |