Tidy
[gitmo/Mouse.git] / lib / ouse.pm
CommitLineData
b0e7066c 1package ouse;
2
3use strict;
4use warnings;
5
b0e7066c 6BEGIN {
7 my $package;
8 sub import {
9 $package = $_[1] || 'Class';
10 if ($package =~ /^\+/) {
11 $package =~ s/^\+//;
12 eval "require $package; 1" or die;
13 }
14 }
15 use Filter::Simple sub { s/^/package $package;\nuse Mouse;\n/; }
16}
17
181;
b0e7066c 19__END__
20
b0e7066c 21=head1 NAME
22
23ouse - syntactic sugar to make Mouse one-liners easier
24
25=head1 SYNOPSIS
26
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
29
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'
34
35=head1 DESCRIPTION
36
1820fffe 37F<ouse.pm> is a simple source filter that adds C<package $name; use Mouse;>
b0e7066c 38to the beginning of your script and was entirely created because typing
1820fffe 39perl C<< -e'package Foo; use Mouse; ...' >> was annoying me... especially after
b0e7066c 40getting used to having C<-Moose> for Moose.
41
42=head1 INTERFACE
43
1820fffe 44C<ouse> provides exactly one method and it is automatically called by perl:
b0e7066c 45
46=over 4
47
1820fffe 48=item C<< oose->import() >>>
b0e7066c 49
50Pass a package name to import to be used by the source filter.
51
52=back
53
54=head1 DEPENDENCIES
55
56You will need L<Filter::Simple> and eventually L<Mouse>
57
58=head1 INCOMPATIBILITIES
59
60None reported. But it is a source filter and might have issues there.
61
1820fffe 62=head1 SEE ALSO
b0e7066c 63
1820fffe 64L<oose> for C<< perl -Moose -e '...' >>
b0e7066c 65
66=head1 AUTHOR
67
68For all intents and purposes, blame:
69
70Chris Prather C<< <perigrin@cpan.org> >>
71
6052a73a 72...who wrote oose.pm, which was adapted for use by Mouse by:
b0e7066c 73
74Ricardo SIGNES C<< <rjbs@cpan.org> >>
75
76=head1 COPYRIGHT AND LICENSE
77
78Copyright 2008 Shawn M Moore.
79
80This program is free software; you can redistribute it and/or modify it
81under the same terms as Perl itself.
82
83=cut