38447163e3cec05466a5de80503968f6d648f107
[gitmo/MooseX-Types-Structured.git] / lib / MooseX / Meta / TypeConstraint / Structured / Positionable.pm
1 package MooseX::Meta::TypeConstraint::Structured::Positionable;
2
3 use strict;
4 use warnings;
5
6 use metaclass;
7
8 use base 'Moose::Meta::TypeConstraint::Parameterizable';
9 use Moose::Util::TypeConstraints ();
10 use MooseX::Meta::TypeConstraint::Structured::Positional;
11
12
13 sub parse_parameter_str {
14     my ($self, @type_strs) = @_; warn '.........................';
15     return map {Moose::Util::TypeConstraints::find_or_create_isa_type_constraint($_)} @type_strs;
16 }
17
18 sub parameterize {
19         my ($self, @contained_tcs) = @_; warn ',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,';
20         my $tc_name = $self->name .'['. join(', ', map {$_->name} @contained_tcs) .']';
21         
22         return MooseX::Meta::TypeConstraint::Structured::Positional->new(
23                 name => $tc_name,
24                 parent => find_type_constraint('ArrayRef'),
25                 package_defined_in => __PACKAGE__,
26                 signature => \@contained_tcs,
27         );                      
28
29 }
30
31
32 1;