blob: 882dd48df8a94200b5844cb65cc56d75ba542661 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
<% encode_json({ error => $error, regions => \@regions}) %>\
<%init>
my( $state, $svcpart ) = $cgi->param('arg');
my $part_svc = qsearchs('part_svc', { 'svcpart'=>$svcpart } );
die "unknown svcpart $svcpart" unless $part_svc;
my @regions = ();
my $error;
if ( $state ) {
my @exports = $part_svc->part_export_did;
if ( scalar(@exports) > 1 ) {
die "more than one DID-providing export attached to svcpart $svcpart";
} elsif ( ! @exports ) {
die "no DID providing export attached to svcpart $svcpart";
}
my $export = $exports[0];
local $@;
local $SIG{__DIE__};
my $something = eval { $export->get_dids('state'=>$state) };
$error = $@;
@regions = @{ $something } if $something;
}
</%init>
|