-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.pl
executable file
·52 lines (38 loc) · 1.03 KB
/
test.pl
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/local/bin/perl -w
use ExtUtils::testlib;
use DWAVDesk;
use warnings;
use strict;
DWAVDesk::Utils::debug("new-perl-avdesk-debug.log");
sub avd_die {
my $what = shift;
die("$what: " . DWAVDesk::Utils::get_error()->{string});
}
sub ok {
my ($code, $what) = @_;
$code or avd_die($what)
}
eval {
my $server = DWAVDesk::Server->new("http://10.3.0.24", 9080, "admin", "test");
$server or avd_die("server");
my $repos = $server->repositories();
$repos or avd_die("repos");
print "Repositories:\n";
foreach my $r (@$repos) {
print "\trev_date => $r->{\"rev_date\"}\n";
print "\trev_id => $r->{\"rev_id\"}\n";
print "\tcode => $r->{\"code\"}\n";
print "\tstate => $r->{\"state\"}\n";
print "\tname => $r->{\"name\"}\n";
print "\n";
}
my $tariff = DWAVDesk::Tariff->new($server);
$tariff->get(DWAVDesk::TARIFF_ID_FREE);
print($tariff->id()."\n");
print($tariff->description()."\n");
print($tariff->name()."\n");
print($tariff->grace_period()."\n");
};
if ($@) {
die "exception: $@";
}