| 1 | package WWW::Google::Contacts::Type::Relation; | ||
| 2 | { | ||
| 3 | 20 | $WWW::Google::Contacts::Type::Relation::VERSION = '0.38'; | |
| 4 | } | ||
| 5 | |||
| 6 | 20 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 20 | ▶ | use MooseX::Types::Moose qw( Str ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | 20 | ▶ | use WWW::Google::Contacts::InternalTypes qw( Rel ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 20 | ▶ | use WWW::Google::Contacts::Meta::Attribute::Trait::XmlField; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | |||
| 11 | 20 | extends 'WWW::Google::Contacts::Type::Base'; | |
| 12 | |||
| 13 | 20 | with 'WWW::Google::Contacts::Roles::HasTypeAndLabel' => { | |
| 14 | valid_types => [ | ||
| 15 | qw( | ||
| 16 | assistant brother child domestic-partner father friend manager | ||
| 17 | mother parent partner referred-by relative sister spouse | ||
| 18 | ) | ||
| 19 | ], | ||
| 20 | default_type => '', | ||
| 21 | }; | ||
| 22 | |||
| 23 | 20 | has value => ( | |
| 24 | isa => Str, | ||
| 25 | is => 'rw', | ||
| 26 | traits => ['XmlField'], | ||
| 27 | xml_key => 'content', | ||
| 28 | predicate => 'has_value', | ||
| 29 | required => 1, | ||
| 30 | ); | ||
| 31 | |||
| 32 | # 'rel' XML key must not have contain a full url, only the value | ||
| 33 | before to_xml_hashref => sub { | ||
| 34 | 3 | ▶ | my $self = shift; |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 35 | 3 | my $type = $self->type->uri; | |
| 36 | 3 | $type =~ s{^.*\#}{}; | |
| 37 | 3 | $self->type->uri($type); | |
| 38 | 20 | }; | |
| 39 | |||
| 40 | 20 | ▶ | no Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 41 | 20 | __PACKAGE__->meta->make_immutable; | |
| 42 | 20 | 1; | |
| 43 | __END__ | ||