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