X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2Fouse.pm;h=aac678122e2585455a5cd76ad387a80b5db7991a;hb=14cf9b5a1724801f786d8c4a79834aa7c063323c;hp=0173553d3aaff47ac93c8dbe14d5b3a4d58a0e88;hpb=7cd845cffe97dbd30a6351545af6e348fa558897;p=gitmo%2FMouse.git diff --git a/lib/ouse.pm b/lib/ouse.pm index 0173553..aac6781 100644 --- a/lib/ouse.pm +++ b/lib/ouse.pm @@ -1,18 +1,15 @@ package ouse; - use Mouse::Util; # enables strict and warnings -BEGIN { - my $package; - sub import { - $package = $_[1] || 'Class'; - if ($package =~ /^\+/) { - $package =~ s/^\+//; - Mouse::Util::load_class($package); - } +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;\nuse Mouse::Util::TypeConstraints;\n/; } } +use Filter::Simple sub { s/^/package $package;\nuse Mouse;\nuse Mouse::Util::TypeConstraints;\n/; }; 1; __END__ @@ -29,16 +26,16 @@ 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 -F is a simple source filter that adds C -to the beginning of your script and was entirely created because typing +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 C provides exactly one method and it is automatically called by perl: