[Moose-commits] r7608 - Moose/trunk/t/000_recipes/basics
autarch at code2.0beta.co.uk
autarch at code2.0beta.co.uk
Tue Feb 10 19:26:28 GMT 2009
Author: autarch
Date: 2009-02-10 11:26:27 -0800 (Tue, 10 Feb 2009)
New Revision: 7608
Modified:
Moose/trunk/t/000_recipes/basics/005_coercion.t
Log:
Update code to match changes made in recipe
Modified: Moose/trunk/t/000_recipes/basics/005_coercion.t
===================================================================
--- Moose/trunk/t/000_recipes/basics/005_coercion.t 2009-02-10 18:45:53 UTC (rev 7607)
+++ Moose/trunk/t/000_recipes/basics/005_coercion.t 2009-02-10 19:26:27 UTC (rev 7608)
@@ -22,31 +22,38 @@
use Params::Coerce ();
use URI ();
- subtype Header => as Object => where { $_->isa('HTTP::Headers') };
+ class_type('HTTP::Headers');
- coerce Header => from ArrayRef => via { HTTP::Headers->new( @{$_} ) } =>
- from HashRef => via { HTTP::Headers->new( %{$_} ) };
+ coerce 'HTTP::Headers'
+ => from 'ArrayRef'
+ => via { HTTP::Headers->new( @{$_} ) }
+ => from 'HashRef'
+ => via { HTTP::Headers->new( %{$_} ) };
- subtype Uri => as Object => where { $_->isa('URI') };
+ class_type('URI');
- coerce Uri => from Object =>
- via { $_->isa('URI') ? $_ : Params::Coerce::coerce( 'URI', $_ ) } =>
- from Str => via { URI->new( $_, 'http' ) };
+ coerce 'URI'
+ => from 'Object'
+ => via { $_->isa('URI')
+ ? $_
+ : Params::Coerce::coerce( 'URI', $_ ); }
+ => from 'Str'
+ => via { URI->new( $_, 'http' ) };
- subtype Protocol => as Str => where {/^HTTP\/[0-9]\.[0-9]$/};
+ subtype 'Protocol'
+ => as 'Str'
+ => where { /^HTTP\/[0-9]\.[0-9]$/ };
- has 'base' => ( is => 'rw', isa => 'Uri', coerce => 1 );
- has 'url' => ( is => 'rw', isa => 'Uri', coerce => 1 );
+ has 'base' => ( is => 'rw', isa => 'URI', coerce => 1 );
+ has 'uri' => ( is => 'rw', isa => 'URI', coerce => 1 );
has 'method' => ( is => 'rw', isa => 'Str' );
has 'protocol' => ( is => 'rw', isa => 'Protocol' );
has 'headers' => (
is => 'rw',
- isa => 'Header',
+ isa => 'HTTP::Headers',
coerce => 1,
default => sub { HTTP::Headers->new }
);
-
- __PACKAGE__->meta->make_immutable( debug => 0 );
}
my $r = Request->new;
More information about the Moose-commits
mailing list