3 use Mouse::Util; # enables strict and warnings
8 $package = $_[1] || 'Class';
9 if ($package =~ /^\+/) {
11 Mouse::Util::load_class($package);
14 use Filter::Simple sub { s/^/package $package;\nuse Mouse;\nuse Mouse::Util::TypeConstraints;\n/; };
21 ouse - syntactic sugar to make Mouse one-liners easier
25 # create a Mouse class on the fly ...
26 perl -Mouse=Foo -e 'has bar => ( is=>q[ro], default => q[baz] ); print Foo->new->bar' # prints baz
28 # loads an existing class (Mouse or non-Mouse)
29 # and re-"opens" the package definition to make
30 # debugging/introspection easier
31 perl -Mouse=+My::Class -e 'print join ", " => __PACKAGE__->meta->get_method_list'
35 F<ouse.pm> is a simple source filter that adds C<package $name; use Mouse;>
36 to the beginning of your script and was entirely created because typing
37 perl C<< -e'package Foo; use Mouse; ...' >> was annoying me... especially after
38 getting used to having C<-Moose> for Moose.
42 C<ouse> provides exactly one method and it is automatically called by perl:
46 =item C<< oose->import() >>>
48 Pass a package name to import to be used by the source filter.
54 You will need L<Filter::Simple> and eventually L<Mouse>
56 =head1 INCOMPATIBILITIES
58 None reported. But it is a source filter and might have issues there.
62 L<oose> for C<< perl -Moose -e '...' >>
66 For all intents and purposes, blame:
68 Chris Prather C<< <perigrin@cpan.org> >>
70 ...who wrote oose.pm, which was adapted for use by Mouse by:
72 Ricardo SIGNES C<< <rjbs@cpan.org> >>
74 =head1 COPYRIGHT AND LICENSE
76 Copyright 2008 Shawn M Moore.
78 This program is free software; you can redistribute it and/or modify it
79 under the same terms as Perl itself.