From: Chris Prather Date: Mon, 19 Oct 2009 04:55:20 +0000 (-0400) Subject: add Moose::Util::TypeConstraints to oose.pm X-Git-Tag: 0.93_01~23 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=405fb8858b07b8a97ce8fa5cf0dc9fbdf1ef4af1;p=gitmo%2FMoose.git add Moose::Util::TypeConstraints to oose.pm Someone came into #moose today trying to test out a question with subtypes. I remembered that it had always annoyed me that I had to include -MMoose::Util::TypeConstraints when using oose.pm. This should fix that, with documentation. --- diff --git a/lib/oose.pm b/lib/oose.pm index af99b05..94b2d32 100644 --- a/lib/oose.pm +++ b/lib/oose.pm @@ -18,7 +18,7 @@ BEGIN { Class::MOP::load_class($package); } } - use Filter::Simple sub { s/^/package $package;\nuse Moose;\n/; } + use Filter::Simple sub { s/^/package $package;\nuse Moose;use Moose::Util::TypeConstraints;\n/; } } 1; @@ -41,6 +41,9 @@ oose - syntactic sugar to make Moose one-liners easier # debugging/introspection easier perl -Moose=+My::Class -e 'print join ", " => __PACKAGE__->meta->get_method_list' + # also loads Moose::Util::TypeConstraints to allow subtypes etc + perl -Moose=Person -e'subtype q[Age] => as q[Int] => where { $_ > 0 && $_ < 78 }; has => age ( isa => q[ValidAge], is => q[ro]); Person->new(age => 90)' + =head1 DESCRIPTION oose.pm is a simple source filter that adds C @@ -75,7 +78,7 @@ to cpan-RT. =head1 AUTHOR -Chris Prather C<< >> +Chris Prather C<< >> =head1 COPYRIGHT AND LICENSE