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