11 $package = $_[1] || 'Class';
12 if ($package =~ /^\+/) {
14 eval "require $package; 1" or die;
17 use Filter::Simple sub { s/^/package $package;\nuse Mouse;\n/; }
28 ouse - syntactic sugar to make Mouse one-liners easier
32 # create a Mouse class on the fly ...
33 perl -Mouse=Foo -e 'has bar => ( is=>q[ro], default => q[baz] ); print Foo->new->bar' # prints baz
35 # loads an existing class (Mouse or non-Mouse)
36 # and re-"opens" the package definition to make
37 # debugging/introspection easier
38 perl -Mouse=+My::Class -e 'print join ", " => __PACKAGE__->meta->get_method_list'
42 ouse.pm is a simple source filter that adds C<package $name; use Mouse;>
43 to the beginning of your script and was entirely created because typing
44 perl -e'package Foo; use Mouse; ...' was annoying me... especially after
45 getting used to having C<-Moose> for Moose.
49 ouse provides exactly one method and it's automically called by perl:
53 =item B<import($package)>
55 Pass a package name to import to be used by the source filter.
61 You will need L<Filter::Simple> and eventually L<Mouse>
63 =head1 INCOMPATIBILITIES
65 None reported. But it is a source filter and might have issues there.
69 All complex software has bugs lurking in it, and this module is no
70 exception. If you find a bug please either email me, or add the bug
75 For all intents and purposes, blame:
77 Chris Prather C<< <perigrin@cpan.org> >>
79 ...who wrote ouse.pm, which was adapted for use by Mouse by:
81 Ricardo SIGNES C<< <rjbs@cpan.org> >>
83 =head1 COPYRIGHT AND LICENSE
85 Copyright 2008 Shawn M Moore.
87 This program is free software; you can redistribute it and/or modify it
88 under the same terms as Perl itself.