line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MooseX::Types::Set::Object; # git description: v0.04-14-g6b3e9b5 |
2
|
|
|
|
|
|
|
# ABSTRACT: Set::Object type with coercions and stuff. |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
our $VERSION = '0.05'; |
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
153967
|
use MooseX::Types; |
|
2
|
|
|
|
|
686142
|
|
|
2
|
|
|
|
|
8
|
|
7
|
2
|
|
|
2
|
|
6024
|
use MooseX::Types::Moose qw(Object ArrayRef); |
|
2
|
|
|
|
|
24337
|
|
|
2
|
|
|
|
|
19
|
|
8
|
2
|
|
|
2
|
|
9962
|
use Set::Object (); |
|
2
|
|
|
|
|
14279
|
|
|
2
|
|
|
|
|
69
|
|
9
|
2
|
|
|
2
|
|
15
|
use if MooseX::Types->VERSION >= 0.42, 'namespace::autoclean'; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
52
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
class_type "Set::Object"; # FIXME not parameterizable |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
coerce "Set::Object", |
14
|
|
|
|
|
|
|
from ArrayRef, |
15
|
|
|
|
|
|
|
via { Set::Object->new(@$_) }; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
coerce ArrayRef, |
18
|
|
|
|
|
|
|
from "Set::Object", |
19
|
|
|
|
|
|
|
via { [$_->members] }; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
1; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
__END__ |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=pod |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=encoding UTF-8 |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 NAME |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
MooseX::Types::Set::Object - Set::Object type with coercions and stuff. |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 VERSION |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
version 0.05 |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 SYNOPSIS |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
package Foo; |
40
|
|
|
|
|
|
|
use Moose; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
use MooseX::Types::Set::Object; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
has children => ( |
45
|
|
|
|
|
|
|
isa => "Set::Object", |
46
|
|
|
|
|
|
|
accessor => "transition_set", |
47
|
|
|
|
|
|
|
coerce => 1, # also accept array refs |
48
|
|
|
|
|
|
|
handles => { |
49
|
|
|
|
|
|
|
children => "members", |
50
|
|
|
|
|
|
|
add_child => "insert", |
51
|
|
|
|
|
|
|
remove_child => "remove", |
52
|
|
|
|
|
|
|
# See Set::Object for all the methods you could delegate |
53
|
|
|
|
|
|
|
}, |
54
|
|
|
|
|
|
|
); |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# ... |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
my $foo = Foo->new( children => [ @objects ] ); |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
$foo->add_child( $obj ); |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 DESCRIPTION |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
This module provides a Moose type constraint (see |
65
|
|
|
|
|
|
|
L<Moose::Util::TypeConstraints>, L<MooseX::Types>). |
66
|
|
|
|
|
|
|
Note that this constraint and its coercions are B<global>, not simply limited to the scope that |
67
|
|
|
|
|
|
|
imported it -- in this way it acts like a regular L<Moose> type constraint, |
68
|
|
|
|
|
|
|
rather than one from L<MooseX::Types>. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 TYPES |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=over 4 |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=item Set::Object |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
A subtype of C<Object> that isa L<Set::Object> with coercions to and from the |
77
|
|
|
|
|
|
|
C<ArrayRef> type. |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=back |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 SEE ALSO |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
L<Set::Object>, L<MooseX::AttributeHandlers>, L<MooseX::Types>, |
84
|
|
|
|
|
|
|
L<Moose::Util::TypeConstraints> |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 AUTHOR |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
×××× ×§××'×× (Yuval Kogman) <nothingmuch@woobling.org> |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 CONTRIBUTORS |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=for stopwords Karen Etheridge Florian Ragwitz |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=over 4 |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=item * |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Karen Etheridge <ether@cpan.org> |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=item * |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Florian Ragwitz <rafl@debian.org> |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=back |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
This software is copyright (c) 2008 by Yuval Kogman. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
111
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=cut |