X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2Foose.pm;h=d32ade9087fcebda9e23d55f8ab7c7cbe4ce05cc;hb=7d93ec414e0d301292d89be61c5845152ab1b913;hp=5f0dcc7468fcc086a700113c17b8f4074343e701;hpb=25374f018116dc632e1625bf401c8893c5df21ff;p=gitmo%2FMoose.git diff --git a/lib/oose.pm b/lib/oose.pm index 5f0dcc7..d32ade9 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.65'; +$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 by Infinity Interactive, Inc. +Copyright 2007-2009 by Infinity Interactive, Inc. L