}
sub parameterize {
- my ($self, @contained_tcs) = @_;
+ my ($self, $parameter_string) = @_;
+ my @contained_tcs = $self->parse_parameter_str($parameter_string);
my $tc_name = $self->name .'['. join(',', map {$_->name} @contained_tcs) .']';
return $self->structured_type->new(
use MooseX::Meta::TypeConstraint::Structured::Positional;
use MooseX::Meta::TypeConstraint::Structured::Named;
-use MooseX::Types -declare => [qw(Dict Tuple Optional)];
- #use Sub::Exporter
- # -setup => { exports => [ qw( Optional) ] };
+#use MooseX::Types -declare => [qw(Dict Tuple Optional)];
+use Sub::Exporter
+ -setup => { exports => [ qw( Dict Tuple Optional) ] };
our $VERSION = '0.01';
our $AUTHORITY = 'cpan:JJNAPIORK';
=cut
-use MooseX::Meta::TypeConstraint::Structured::Positionable;
-
-my $tuple = MooseX::Meta::TypeConstraint::Structured::Positionable->new(
- name => 'Tuple',
- package_defined_in => __PACKAGE__,
- parent => find_type_constraint('Ref'),
- );
-
-Moose::Util::TypeConstraints::register_type_constraint($tuple);
-
-subtype Tuple, as 'Tuple';
-
-
sub Optional($) {
return bless {args=>shift}, 'MooseX::Types::Optional';
}
-sub TupleX($) {
+sub Tuple($) {
my ($args, $optional) = _normalize_args(@_);
my @args = @$args;
my @optional = ref $optional eq 'ARRAY' ? @$optional : ();
);
}
-sub DictX($) {
+sub Dict($) {
my ($args, $optional) = _normalize_args(@_);
my %args = @$args;
my %optional = ref $optional eq 'ARRAY' ? @$optional : ();
use Test::Exception;
use_ok 'Moose::Util::TypeConstraints';
- use_ok 'MooseX::Meta::TypeConstraint::Structured::Structurable';
+ use_ok 'MooseX::Meta::TypeConstraint::Structured::Generator';
use_ok 'MooseX::Meta::TypeConstraint::Structured::Positional';
use_ok 'MooseX::Meta::TypeConstraint::Structured::Named';
}
-my $tuple = MooseX::Meta::TypeConstraint::Structured::Structurable->new(
+my $tuple = MooseX::Meta::TypeConstraint::Structured::Generator->new(
name => 'Tuple',
structured_type => 'MooseX::Meta::TypeConstraint::Structured::Positional',
package_defined_in => __PACKAGE__,
=> 'Found the Tuple Type';
{
- package Test::MooseX::Types::Structured::Positionable;
+ package Test::MooseX::Types::Structured::BasicAttributes;
use Moose;
use Moose::Util::TypeConstraints;
}
-ok my $positioned_obj = Test::MooseX::Types::Structured::Positionable->new,
+ok my $positioned_obj = Test::MooseX::Types::Structured::BasicAttributes->new,
=> 'Got a good object';
ok $positioned_obj->tuple([1,'hello',3])