# this confirms that provides has
# all valid possibilities in it
sub _check_provides {
- my ($self, $provides) = @_;
+ my $self = shift;
my $method_constructors = $self->method_constructors;
- foreach my $key (keys %$provides) {
+ foreach my $key (keys %{$self->provides}) {
(exists $method_constructors->{$key})
|| confess "$key is an unsupported method type";
}
}
before '_process_options' => sub {
- my ($self, %options) = @_;
- if (exists $options{provides}) {
- $self->_check_provides($options{provides});
- $self->_process_options_for_provides(\%options);
+ my ($self, $name, $options) = @_;
+ if (exists $options->{provides}) {
+ $self->_process_options_for_provides($options);
}
};
my $attr = shift;
my $class = $attr->associated_class;
+ # before we install them, lets
+ # make sure they are valid
+ $attr->_check_provides;
+
my $method_constructors = $attr->method_constructors;
foreach my $key (keys %{$attr->provides}) {
package MooseX::AttributeHelpers::Collection::Array;
use Moose;
+use Moose::Util::TypeConstraints;
our $VERSION = '0.01';
our $AUTHORITY = 'cpan:STEVAN';
(exists $options->{isa})
|| confess "You must define a type with the Array metaclass";
- (find_type_constraint($options->{isa})->is_subtype_of('ArrayRef'))
- || confess "The type constraint for a Array must be a subtype of ArrayRef";
+ (find_type_constraint($options->{isa})->is_a_type_of('ArrayRef'))
+ || confess "The type constraint for a Array ($options->{isa}) must be a subtype of ArrayRef";
}
no Moose;
+no Moose::Util::TypeConstraints;;
# register the alias ...
package Moose::Meta::Attribute::Custom::Collection::Array;
package MooseX::AttributeHelpers::Collection::Hash;
use Moose;
+use Moose::Util::TypeConstraints;
our $VERSION = '0.01';
our $AUTHORITY = 'cpan:STEVAN';
(exists $options->{isa})
|| confess "You must define a type with the Hash metaclass";
- (find_type_constraint($options->{isa})->is_subtype_of('HashRef'))
- || confess "The type constraint for a Hash must be a subtype of HashRef";
+ (find_type_constraint($options->{isa})->is_a_type_of('HashRef'))
+ || confess "The type constraint for a Hash ($options->{isa}) must be a subtype of HashRef";
}
no Moose;
+no Moose::Util::TypeConstraints;
# register the alias ...
package Moose::Meta::Attribute::Custom::Collection::Hash;
package MooseX::AttributeHelpers::Counter;
use Moose;
+use Moose::Util::TypeConstraints;
our $VERSION = '0.01';
our $AUTHORITY = 'cpan:STEVAN';
(exists $options->{isa})
|| confess "You must define a type with the Counter metaclass";
- (find_type_constraint($options->{isa})->is_subtype_of('Num'))
- || confess "The type constraint for a Counter must be a subtype of Num";
+ (find_type_constraint($options->{isa})->is_a_type_of('Num'))
+ || confess "The type constraint for a Counter ($options->{isa}) must be a subtype of Num";
}
no Moose;
+no Moose::Util::TypeConstraints;
# register the alias ...
package Moose::Meta::Attribute::Custom::Counter;
use strict;
use warnings;
+use Test::More no_plan => 1;
+
BEGIN {
use_ok('MooseX::AttributeHelpers');
}
use Test::More;
eval "use Test::Pod::Coverage 1.04";
-plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage" if $@;
+plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage"; # if $@;
all_pod_coverage_ok();