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