-
Notifications
You must be signed in to change notification settings - Fork 196
/
Internal.pm
72 lines (61 loc) · 1.89 KB
/
Internal.pm
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package MetaCPAN::Types::Internal;
use strict;
use warnings;
use ElasticSearchX::Model::Document::Types qw( Type );
use MooseX::Getopt::OptionTypeMap ();
use MooseX::Types::Moose qw( ArrayRef HashRef );
use MooseX::Types -declare => [ qw(
Module
Identity
Dependency
Profile
) ];
subtype Module, as ArrayRef [ Type ['MetaCPAN::Document::Module'] ];
coerce Module, from ArrayRef, via {
[ map { ref $_ eq 'HASH' ? MetaCPAN::Document::Module->new($_) : $_ }
@$_ ];
};
coerce Module, from HashRef, via { [ MetaCPAN::Document::Module->new($_) ] };
subtype Identity, as ArrayRef [ Type ['MetaCPAN::Model::User::Identity'] ];
coerce Identity, from ArrayRef, via {
[
map {
ref $_ eq 'HASH'
? MetaCPAN::Model::User::Identity->new($_)
: $_
} @$_
];
};
coerce Identity, from HashRef,
via { [ MetaCPAN::Model::User::Identity->new($_) ] };
subtype Dependency, as ArrayRef [ Type ['MetaCPAN::Document::Dependency'] ];
coerce Dependency, from ArrayRef, via {
[
map {
ref $_ eq 'HASH'
? MetaCPAN::Document::Dependency->new($_)
: $_
} @$_
];
};
coerce Dependency, from HashRef,
via { [ MetaCPAN::Document::Dependency->new($_) ] };
subtype Profile, as ArrayRef [ Type ['MetaCPAN::Document::Author::Profile'] ];
coerce Profile, from ArrayRef, via {
[
map {
ref $_ eq 'HASH'
? MetaCPAN::Document::Author::Profile->new($_)
: $_
} @$_
];
};
coerce Profile, from HashRef,
via { [ MetaCPAN::Document::Author::Profile->new($_) ] };
MooseX::Getopt::OptionTypeMap->add_option_type_to_map(
'MooseX::Types::ElasticSearch::ES' => '=s' );
use MooseX::Attribute::Deflator;
deflate 'ScalarRef', via {$$_};
inflate 'ScalarRef', via { \$_ };
no MooseX::Attribute::Deflator;
1;