Skip to content

Commit 1ce41ec

Browse files
committed
explicitly load modules for ES sub types
1 parent 4e2c206 commit 1ce41ec

File tree

4 files changed

+31
-15
lines changed

4 files changed

+31
-15
lines changed

lib/MetaCPAN/Document/Author.pm

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ use ElasticSearchX::Model::Document::Types qw( Location );
77
use ElasticSearchX::Model::Document;
88

99
# load order not important
10-
use Gravatar::URL ();
11-
use MetaCPAN::Types qw( ESBool Profile );
12-
use MetaCPAN::Types::TypeTiny qw(
10+
use Gravatar::URL ();
11+
use MetaCPAN::Document::Author::Profile ();
12+
use MetaCPAN::Types qw( ESBool Profile );
13+
use MetaCPAN::Types::TypeTiny qw(
1314
ArrayRef
1415
ArrayRefPromote
1516
Blog

lib/MetaCPAN/Document/Release.pm

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ package MetaCPAN::Document::Release;
33
use Moose;
44

55
use ElasticSearchX::Model::Document;
6-
use MetaCPAN::Types qw( ESBool Dependency );
7-
use MetaCPAN::Types::TypeTiny qw(
6+
use MetaCPAN::Document::Dependency ();
7+
use MetaCPAN::Types qw( ESBool Dependency );
8+
use MetaCPAN::Types::TypeTiny qw(
89
ArrayRef
910
HashRefCPANMeta
1011
Num

lib/MetaCPAN/Model/User/Account.pm

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ use warnings;
66
use Moose;
77
use ElasticSearchX::Model::Document;
88

9-
use MetaCPAN::Types qw( ESBool Identity );
10-
use MetaCPAN::Types::TypeTiny qw( ArrayRef Dict Str );
11-
use MetaCPAN::Util qw(true false);
9+
use MetaCPAN::Model::User::Identity ();
10+
use MetaCPAN::Types qw( ESBool Identity );
11+
use MetaCPAN::Types::TypeTiny qw( ArrayRef Dict Str );
12+
use MetaCPAN::Util qw(true false);
1213

1314
=head1 PROPERTIES
1415

lib/MetaCPAN/Types/Internal.pm

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,18 @@ use MooseX::Types -declare => [ qw(
1919

2020
subtype Module, as ArrayRef [ Type ['MetaCPAN::Document::Module'] ];
2121
coerce Module, from ArrayRef, via {
22+
require MetaCPAN::Document::Module;
2223
[ map { ref $_ eq 'HASH' ? MetaCPAN::Document::Module->new($_) : $_ }
2324
@$_ ];
2425
};
25-
coerce Module, from HashRef, via { [ MetaCPAN::Document::Module->new($_) ] };
26+
coerce Module, from HashRef, via {
27+
require MetaCPAN::Document::Module;
28+
[ MetaCPAN::Document::Module->new($_) ];
29+
};
2630

2731
subtype Identity, as ArrayRef [ Type ['MetaCPAN::Model::User::Identity'] ];
2832
coerce Identity, from ArrayRef, via {
33+
require MetaCPAN::Model::User::Identity;
2934
[
3035
map {
3136
ref $_ eq 'HASH'
@@ -34,11 +39,14 @@ coerce Identity, from ArrayRef, via {
3439
} @$_
3540
];
3641
};
37-
coerce Identity, from HashRef,
38-
via { [ MetaCPAN::Model::User::Identity->new($_) ] };
42+
coerce Identity, from HashRef, via {
43+
require MetaCPAN::Model::User::Identity;
44+
[ MetaCPAN::Model::User::Identity->new($_) ];
45+
};
3946

4047
subtype Dependency, as ArrayRef [ Type ['MetaCPAN::Document::Dependency'] ];
4148
coerce Dependency, from ArrayRef, via {
49+
require MetaCPAN::Document::Dependency;
4250
[
4351
map {
4452
ref $_ eq 'HASH'
@@ -47,11 +55,14 @@ coerce Dependency, from ArrayRef, via {
4755
} @$_
4856
];
4957
};
50-
coerce Dependency, from HashRef,
51-
via { [ MetaCPAN::Document::Dependency->new($_) ] };
58+
coerce Dependency, from HashRef, via {
59+
require MetaCPAN::Document::Dependency;
60+
[ MetaCPAN::Document::Dependency->new($_) ];
61+
};
5262

5363
subtype Profile, as ArrayRef [ Type ['MetaCPAN::Document::Author::Profile'] ];
5464
coerce Profile, from ArrayRef, via {
65+
require MetaCPAN::Document::Author::Profile;
5566
[
5667
map {
5768
ref $_ eq 'HASH'
@@ -60,8 +71,10 @@ coerce Profile, from ArrayRef, via {
6071
} @$_
6172
];
6273
};
63-
coerce Profile, from HashRef,
64-
via { [ MetaCPAN::Document::Author::Profile->new($_) ] };
74+
coerce Profile, from HashRef, via {
75+
require MetaCPAN::Document::Author::Profile;
76+
[ MetaCPAN::Document::Author::Profile->new($_) ];
77+
};
6578

6679
MooseX::Getopt::OptionTypeMap->add_option_type_to_map(
6780
'MooseX::Types::ElasticSearch::ES' => '=s' );

0 commit comments

Comments
 (0)