From 80232d581e7a82f0ec8bd85d269a1604fdbe58c7 Mon Sep 17 00:00:00 2001 From: Brian Phillips Date: Tue, 4 Dec 2012 22:27:23 -0600 Subject: clean up types - Split out type declarations into separate class - Use namespaced types instead of global types (via MooseX::Types) - use declared types where possible, instead of quoted type names (i.e. isa => Str, instead of isa => 'Str') - Allow "authentication" attribute to coerce from a JSON::is_bool() value (instead of expecting it to be a 1 or a 0 all the time) --- lib/Net/HTTP/Spore/Role/Description.pm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'lib/Net/HTTP/Spore/Role/Description.pm') diff --git a/lib/Net/HTTP/Spore/Role/Description.pm b/lib/Net/HTTP/Spore/Role/Description.pm index 2723fef..cad1084 100644 --- a/lib/Net/HTTP/Spore/Role/Description.pm +++ b/lib/Net/HTTP/Spore/Role/Description.pm @@ -3,7 +3,9 @@ package Net::HTTP::Spore::Role::Description; # ABSTRACT: attributes for API description use Moose::Role; +use MooseX::Types::Moose qw/ArrayRef/; use MooseX::Types::URI qw/Uri/; +use Net::HTTP::Spore::Meta::Types qw/Boolean/; has base_url => ( is => 'rw', @@ -14,19 +16,20 @@ has base_url => ( has formats => ( is => 'rw', - isa => 'ArrayRef', + isa => ArrayRef, predicate => 'has_formats', ); has authentication => ( is => 'rw', - isa => 'Bool', + isa => Boolean, predicate => 'has_authentication', + coerce => 1, ); has expected_status => ( is => 'rw', - isa => 'Array', + isa => ArrayRef, lazy => 1, default => sub { [] }, ); -- cgit v1.2.3