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;\n/; }
}
+use Filter::Simple sub { s/^/package $package;\nuse Mouse;\nuse Mouse::Util::TypeConstraints;\n/; };
1;
__END__
# 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<ouse.pm> is a simple source filter that adds C<package $name; use Mouse;>
-to the beginning of your script and was entirely created because typing
+F<ouse.pm> is a simple source filter that adds C<package $name; use Mouse;>
+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<ouse> provides exactly one method and it is automatically called by perl: