Bump to 0.56
[gitmo/Moose.git] / lib / oose.pm
CommitLineData
3eca5b1c 1package oose;
004222dc 2
3eca5b1c 3use strict;
25374f01 4use warnings;
5
0addec44 6use Class::MOP;
1321f087 7
a94188ac 8our $VERSION = '0.56';
25374f01 9our $AUTHORITY = 'cpan:STEVAN';
3eca5b1c 10
11BEGIN {
12 my $package;
1321f087 13 sub import {
14 $package = $_[1] || 'Class';
15 if ($package =~ /^\+/) {
16 $package =~ s/^\+//;
17 Class::MOP::load_class($package);
18 }
19 }
3eca5b1c 20 use Filter::Simple sub { s/^/package $package;\nuse Moose;\n/; }
21}
3eca5b1c 22
25374f01 231;
3eca5b1c 24
25374f01 25__END__
3eca5b1c 26
25374f01 27=pod
3eca5b1c 28
25374f01 29=head1 NAME
3eca5b1c 30
25374f01 31oose - syntactic sugar to make Moose one-liners easier
3eca5b1c 32
33=head1 SYNOPSIS
34
1321f087 35 # create a Moose class on the fly ...
36 perl -Moose=Foo -e 'has bar => ( is=>q[ro], default => q[baz] ); print Foo->new->bar' # prints baz
37
38 # loads an existing class (Moose or non-Moose)
39 # and re-"opens" the package definition to make
40 # debugging/introspection easier
41 perl -Moose=+My::Class -e 'print join ", " => __PACKAGE__->meta->get_method_list'
3eca5b1c 42
43=head1 DESCRIPTION
44
25374f01 45oose.pm is a simple source filter that adds C<package $name; use Moose;>
46to the beginning of your script and was entirely created because typing
47perl -e'package Foo; use Moose; ...' was annoying me.
3eca5b1c 48
49=head1 INTERFACE
50
51oose provides exactly one method and it's automically called by perl:
1aa48307 52
25374f01 53=over 4
3eca5b1c 54
25374f01 55=item B<import($package)>
3eca5b1c 56
25374f01 57Pass a package name to import to be used by the source filter.
3eca5b1c 58
59=back
60
3eca5b1c 61=head1 DEPENDENCIES
62
3eca5b1c 63You will need L<Filter::Simple> and eventually L<Moose>
64
3eca5b1c 65=head1 INCOMPATIBILITIES
66
3eca5b1c 67None reported. But it is a source filter and might have issues there.
68
25374f01 69=head1 BUGS
3eca5b1c 70
25374f01 71All complex software has bugs lurking in it, and this module is no
72exception. If you find a bug please either email me, or add the bug
73to cpan-RT.
3eca5b1c 74
75=head1 AUTHOR
76
77Chris Prather C<< <perigrin@cpan.org> >>
78
25374f01 79=head1 COPYRIGHT AND LICENSE
3eca5b1c 80
778db3ac 81Copyright 2007-2008 by Infinity Interactive, Inc.
3eca5b1c 82
25374f01 83L<http://www.iinteractive.com>
3eca5b1c 84
25374f01 85This library is free software; you can redistribute it and/or modify
86it under the same terms as Perl itself.
3eca5b1c 87
25374f01 88=cut