ORM/Types/Internal.pm

filter: Statementstmt 76.4% 26 / 34 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 58.3% 7 / 12 Podpod n/a totaltotal 71.7% 33 / 46 SCAR 0.1
CC
1
Cov
76%
__ANON__
2.0
__ANON__
2.0
__ANON__
1.3
CRAP 1.0
« Meta/Method/Constructor.pm ↑ Summary Object/Iterator/FromArray.pm »
1 package Fey::ORM::Types::Internal;
2 {
3 13 $Fey::ORM::Types::Internal::VERSION = '0.46';
4 }
5  
6 13 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 13 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 13 use MooseX::Types -declare => [
10 qw(
11 ArrayRefOfClasses
12 ClassDoesIterator
13 DoesHasMany
14 DoesHasOne
15 IterableArrayRef
16 TableWithSchema
17 )
18 13 ▶];
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 use MooseX::Types::Moose
21 13 ▶ qw( ArrayRef ClassName Object Undef );
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 13 role_type DoesHasMany, { role => 'Fey::Meta::Role::Relationship::HasMany' };
24 13 role_type DoesHasOne, { role => 'Fey::Meta::Role::Relationship::HasOne' };
25  
26 #<<<
27 subtype TableWithSchema,
28 as class_type('Fey::Table'),
29 42 ▶ where { $_[0]->has_schema() },
Subroutine __ANON__: called CC=1 SCAR=0.0
30 message {
31 2 ▶ 'A table used for has-one or -many relationships must have a schema'
Subroutine __ANON__: called CC=1 SCAR=0.0
32 13 };
33  
34 subtype ClassDoesIterator,
35 as ClassName,
36 7 ▶ where { $_[0]->meta()->does_role('Fey::ORM::Role::Iterator') },
Subroutine __ANON__: called CC=1 SCAR=0.0
37 0 ▶ message {"$_[0] does not do the Fey::ORM::Role::Iterator role"};
Subroutine __ANON__: not called CC=1 SCAR=1.2
38  
39 subtype ArrayRefOfClasses,
40 as ArrayRef[ClassName],
41 0 ▶ where { @{$_} > 0 };
Subroutine __ANON__: not called CC=1 SCAR=2.6
42  
43 coerce ArrayRefOfClasses,
44 from ClassName,
45 0 ▶ via { return [$_] };
Subroutine __ANON__: not called CC=1 SCAR=1.2
46  
47  
48 subtype IterableArrayRef,
49 as ArrayRef[ArrayRef[Object|Undef]],
50 message {
51 0 ▶ 'You must provide an array reference of which each '
Subroutine __ANON__: not called CC=1 SCAR=6.9
52 . ' element is in turn an array reference. The inner '
53 . ' references should contain objects or undef.';
54 13 };
55  
56 coerce IterableArrayRef,
57 from ArrayRef[Object|Undef],
58 via {
59 0 ▶ [ map { [$_] } @{$_} ];
Subroutine __ANON__: not called CC=1 SCAR=6.9
60 13 };
61 #>>>
62  
63 13 1;
64  
65 # ABSTRACT: Types for use in Fey::ORM
66  
67 __END__
68  
69 =pod
70  
71 =head1 NAME
72  
73 Fey::ORM::Types::Internal - Types for use in Fey::ORM
74  
75 =head1 VERSION
76  
77 version 0.46
78  
79 =head1 DESCRIPTION
80  
81 This module defines a whole bunch of types used by the Fey::ORM core
82 classes. None of these types are documented for external use at the present,
83 though that could change in the future.
84  
85 =head1 BUGS
86  
87 See L<Fey::ORM> for details on how to report bugs.
88  
89 =head1 AUTHOR
90  
91 Dave Rolsky <autarch@urth.org>
92  
93 =head1 COPYRIGHT AND LICENSE
94  
95 This software is copyright (c) 2011 by Dave Rolsky.
96  
97 This is free software; you can redistribute it and/or modify it under
98 the same terms as the Perl 5 programming language system itself.
99  
100 =cut
« Meta/Method/Constructor.pm ↑ Summary Object/Iterator/FromArray.pm »