line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojo::Cloudstack::Base; |
2
|
1
|
|
|
1
|
|
5
|
use Mojo::Base -base; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
7
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
sub new { |
5
|
0
|
|
|
0
|
1
|
|
my $class = shift; |
6
|
0
|
|
|
|
|
|
my $cs_class = shift; |
7
|
0
|
|
|
|
|
|
my $self = bless shift, $cs_class; |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
162
|
no strict 'refs'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
32
|
|
10
|
1
|
|
|
1
|
|
5
|
no warnings 'redefine'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
265
|
|
11
|
0
|
|
|
|
|
|
foreach my $key (keys %$self){ |
12
|
|
|
|
|
|
|
#TODO test $self->attr($key => sub { $self->{$key} }); |
13
|
|
|
|
|
|
|
#TODO disable no warnings 'redefine'; |
14
|
0
|
|
|
|
|
|
*{"${cs_class}::${key}"} = sub { |
15
|
0
|
|
|
0
|
|
|
my ($self, $value) = @_; |
16
|
0
|
0
|
0
|
|
|
|
return $value ? (($self->{$key} = $value) and $self) : $self->{$key}; |
17
|
0
|
|
|
|
|
|
}; |
18
|
0
|
0
|
|
|
|
|
if($key eq 'jobresult'){ |
19
|
0
|
|
|
|
|
|
my $otype = (keys %{$self->{jobresult}})[0]; |
|
0
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
|
$self->$key( |
21
|
|
|
|
|
|
|
Mojo::Cloudstack::Base->new('Mojo::Cloudstack::' . ucfirst($otype), $self->{$key}{$otype}) |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
} |
25
|
0
|
|
|
|
|
|
return $self; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
1; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
__END__ |