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;\n/; }
22 ouse - syntactic sugar to make Mouse one-liners easier
26 # create a Mouse class on the fly ...
27 perl -Mouse=Foo -e 'has bar => ( is=>q[ro], default => q[baz] ); print Foo->new->bar' # prints baz
29 # loads an existing class (Mouse or non-Mouse)
30 # and re-"opens" the package definition to make
31 # debugging/introspection easier
32 perl -Mouse=+My::Class -e 'print join ", " => __PACKAGE__->meta->get_method_list'
36 F<ouse.pm> is a simple source filter that adds C<package $name; use Mouse;>
37 to the beginning of your script and was entirely created because typing
38 perl C<< -e'package Foo; use Mouse; ...' >> was annoying me... especially after
39 getting used to having C<-Moose> for Moose.
43 C<ouse> provides exactly one method and it is automatically called by perl:
47 =item C<< oose->import() >>>
49 Pass a package name to import to be used by the source filter.
55 You will need L<Filter::Simple> and eventually L<Mouse>
57 =head1 INCOMPATIBILITIES
59 None reported. But it is a source filter and might have issues there.
63 L<oose> for C<< perl -Moose -e '...' >>
67 For all intents and purposes, blame:
69 Chris Prather C<< <perigrin@cpan.org> >>
71 ...who wrote oose.pm, which was adapted for use by Mouse by:
73 Ricardo SIGNES C<< <rjbs@cpan.org> >>
75 =head1 COPYRIGHT AND LICENSE
77 Copyright 2008 Shawn M Moore.
79 This program is free software; you can redistribute it and/or modify it
80 under the same terms as Perl itself.