blob: 644793d7f9660a607cee122c1d2ab99a8fe4355b (
plain) (
blame)
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
|
package Graph::GEXF::Role::Attributes;
use MooseX::Role::Parameterized;
parameter for => (
is => 'ro',
required => 1,
);
role {
my $p = shift;
foreach my $type (@{$p->for}) {
my $attr_name = $type . '_attributes';
has $attr_name => (
traits => ['Hash'],
is => 'rw',
isa => 'HashRef',
lazy => 1,
default => sub { {} },
handles => {
'attributes_' . $type . '_total' => 'count',
'set_' . $type . '_attribute' => 'set',
'get_' . $type . '_attribute' => 'get',
'attributes_' . $type . '_list' => 'keys',
'has_'.$type.'_attribute' => 'exists',
}
);
}
};
1;
|