line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WWW::BigDoor::Attribute; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
4261
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
132
|
|
4
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
63
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
11
|
use Carp; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
172
|
|
7
|
|
|
|
|
|
|
#use Smart::Comments -ENV; |
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
12
|
use base qw(WWW::BigDoor::Resource Class::Accessor); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
1673
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
__PACKAGE__->follow_best_practice; |
12
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors( qw(id attributes friendly_id read_only) ); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# FIXME DRY with URL |
15
|
|
|
|
|
|
|
sub associate_with { |
16
|
1
|
|
|
1
|
1
|
3763
|
my ( $self, $resource, $client ) = @_; |
17
|
|
|
|
|
|
|
|
18
|
1
|
50
|
|
|
|
7
|
unless ( defined $self->get_id ) { |
19
|
0
|
|
|
|
|
0
|
croak 'URL should have ID - save before associating'; |
20
|
|
|
|
|
|
|
} |
21
|
1
|
50
|
|
|
|
21
|
unless ( defined $resource->get_id ) { |
22
|
0
|
|
|
|
|
0
|
croak 'Object should have ID - save before associating'; |
23
|
|
|
|
|
|
|
} |
24
|
1
|
|
|
|
|
33
|
my $ep = $self->_end_point; |
25
|
|
|
|
|
|
|
|
26
|
1
|
|
|
|
|
6
|
my $result = $client->POST( |
27
|
|
|
|
|
|
|
sprintf( '%s/%s/%s/%s', |
28
|
|
|
|
|
|
|
$ep, $self->get_id, $resource->get_resource_name, |
29
|
|
|
|
|
|
|
$resource->get_id ), |
30
|
|
|
|
|
|
|
{format => 'json'} |
31
|
|
|
|
|
|
|
); |
32
|
1
|
|
|
|
|
11
|
return $result; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |
36
|
|
|
|
|
|
|
__END__ |