/[Frey]/trunk/lib/Frey/Types.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /trunk/lib/Frey/Types.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1133 - (hide annotations)
Tue Jun 30 15:10:55 2009 UTC (14 years, 10 months ago) by dpavlin
File size: 611 byte(s)
make classes immutable and remove moose droppings to make Perl::Critic::Moose happy
1 dpavlin 174 package Frey::Types;
2     use Moose::Util::TypeConstraints;
3    
4     use URI ();
5    
6     subtype 'Uri'
7     => as 'Object'
8 dpavlin 926 => where { $_->isa('URI') }
9     ;
10 dpavlin 174
11     coerce 'Uri'
12     => from 'Object'
13     => via { $_->isa('URI')
14     ? $_
15     : Params::Coerce::coerce( 'URI', $_ ) }
16     => from 'Str'
17 dpavlin 926 => via { URI->new( $_ ) }
18     ;
19 dpavlin 174
20 dpavlin 932 subtype 'Sponge'
21     => as 'HashRef'
22 dpavlin 926 => where {
23     defined $_->{rows} || die "no rows in sponge";
24 dpavlin 932 ref( $_->{rows} ) eq 'ARRAY' || die "rows not ARRAY";
25 dpavlin 926 defined $_->{NAME} || die "no NAME in sponge";
26     }
27     ;
28    
29 dpavlin 932 use DBI ();
30    
31     subtype 'dsn'
32     => as 'Str'
33     => where {
34     DBI->parse_dsn( $_ );
35     }
36     ;
37    
38 dpavlin 1133 no Moose::Util::TypeConstraints;
39    
40 dpavlin 174 1;

  ViewVC Help
Powered by ViewVC 1.1.26