X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2Foose.pm;h=ea71bb909b80125a5d00f323d8776942eb4b473c;hb=refs%2Ftags%2F0.66;hp=38a658f7749a49c093ceffa770aa6503ef094dba;hpb=778db3ac5dc266115efefdeb6dcbcf9b2444d9c9;p=gitmo%2FMoose.git diff --git a/lib/oose.pm b/lib/oose.pm index 38a658f..ea71bb9 100644 --- a/lib/oose.pm +++ b/lib/oose.pm @@ -3,12 +3,21 @@ package oose; use strict; use warnings; -our $VERSION = '0.01'; +use Class::MOP; + +our $VERSION = '0.66'; +$VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; BEGIN { my $package; - sub import { $package = $_[1] } + sub import { + $package = $_[1] || 'Class'; + if ($package =~ /^\+/) { + $package =~ s/^\+//; + Class::MOP::load_class($package); + } + } use Filter::Simple sub { s/^/package $package;\nuse Moose;\n/; } } @@ -24,7 +33,13 @@ oose - syntactic sugar to make Moose one-liners easier =head1 SYNOPSIS - perl -Moose=Foo -e 'has bar => ( is=>q[ro], default => q[baz] ); print Foo->new->bar' # prints baz + # create a Moose class on the fly ... + perl -Moose=Foo -e 'has bar => ( is=>q[ro], default => q[baz] ); print Foo->new->bar' # prints baz + + # loads an existing class (Moose or non-Moose) + # and re-"opens" the package definition to make + # debugging/introspection easier + perl -Moose=+My::Class -e 'print join ", " => __PACKAGE__->meta->get_method_list' =head1 DESCRIPTION @@ -34,7 +49,7 @@ perl -e'package Foo; use Moose; ...' was annoying me. =head1 INTERFACE -oose provides exactly one method and it's automically called by perl: +oose provides exactly one method and it's automatically called by perl: =over 4 @@ -64,7 +79,7 @@ Chris Prather C<< >> =head1 COPYRIGHT AND LICENSE -Copyright 2007-2008 by Infinity Interactive, Inc. +Copyright 2007-2009 by Infinity Interactive, Inc. L