X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2Fouse.pm;h=aac678122e2585455a5cd76ad387a80b5db7991a;hb=7f881031a63a80846be81c6f06e7285095582782;hp=eb4f7ac85c460b60ea494ef3a2b6d1e2bbc04d87;hpb=b0e7066c94be745b934c0c2b8948c22fbff0ad72;p=gitmo%2FMouse.git diff --git a/lib/ouse.pm b/lib/ouse.pm index eb4f7ac..aac6781 100644 --- a/lib/ouse.pm +++ b/lib/ouse.pm @@ -1,28 +1,19 @@ package ouse; - -use strict; -use warnings; - -our $VERSION = '0.59'; - -BEGIN { - my $package; - sub import { - $package = $_[1] || 'Class'; - if ($package =~ /^\+/) { - $package =~ s/^\+//; - eval "require $package; 1" or die; - } +use Mouse::Util; # enables strict and warnings + +my $package = 'Class'; +sub import { + $package = $_[1] || 'Class'; + if ($package =~ /^\+/) { + $package =~ s/^\+//; + Mouse::Util::load_class($package); } - use Filter::Simple sub { s/^/package $package;\nuse Mouse;\n/; } } +use Filter::Simple sub { s/^/package $package;\nuse Mouse;\nuse Mouse::Util::TypeConstraints;\n/; }; 1; - __END__ -=pod - =head1 NAME ouse - syntactic sugar to make Mouse one-liners easier @@ -35,22 +26,22 @@ ouse - syntactic sugar to make Mouse one-liners easier # loads an existing class (Mouse or non-Mouse) # and re-"opens" the package definition to make # debugging/introspection easier - perl -Mouse=+My::Class -e 'print join ", " => __PACKAGE__->meta->get_method_list' + perl -Mouse=+My::Class -e 'print join ", " => __PACKAGE__->meta->get_method_list' =head1 DESCRIPTION -ouse.pm is a simple source filter that adds C -to the beginning of your script and was entirely created because typing -perl -e'package Foo; use Mouse; ...' was annoying me... especially after +F is a simple source filter that adds C +to the beginning of your script and was entirely created because typing +perl C<< -e'package Foo; use Mouse; ...' >> was annoying me... especially after getting used to having C<-Moose> for Moose. -=head1 INTERFACE +=head1 INTERFACE -ouse provides exactly one method and it's automically called by perl: +C provides exactly one method and it is automatically called by perl: =over 4 -=item B +=item C<< oose->import() >>> Pass a package name to import to be used by the source filter. @@ -64,11 +55,9 @@ You will need L and eventually L None reported. But it is a source filter and might have issues there. -=head1 BUGS +=head1 SEE ALSO -All complex software has bugs lurking in it, and this module is no -exception. If you find a bug please either email me, or add the bug -to cpan-RT. +L for C<< perl -Moose -e '...' >> =head1 AUTHOR @@ -76,7 +65,7 @@ For all intents and purposes, blame: Chris Prather C<< >> -...who wrote ouse.pm, which was adapted for use by Mouse by: +...who wrote oose.pm, which was adapted for use by Mouse by: Ricardo SIGNES C<< >>