Add built local::lib
[catagits/Gitalist.git] / local-lib5 / lib / perl5 / oose.pm
CommitLineData
3fea05b9 1package oose;
2
3use strict;
4use warnings;
5
6use Class::MOP;
7
8our $VERSION = '0.93';
9$VERSION = eval $VERSION;
10our $AUTHORITY = 'cpan:STEVAN';
11
12BEGIN {
13 my $package;
14 sub import {
15 $package = $_[1] || 'Class';
16 if ($package =~ /^\+/) {
17 $package =~ s/^\+//;
18 Class::MOP::load_class($package);
19 }
20 }
21 use Filter::Simple sub { s/^/package $package;\nuse Moose;\n/; }
22}
23
241;
25
26__END__
27
28=pod
29
30=head1 NAME
31
32oose - syntactic sugar to make Moose one-liners easier
33
34=head1 SYNOPSIS
35
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'
43
44=head1 DESCRIPTION
45
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
48C<perl -e'package Foo; use Moose; ...'> was annoying me.
49
50=head1 INTERFACE
51
52oose provides exactly one method and it's automatically called by perl:
53
54=over 4
55
56=item B<import($package)>
57
58Pass a package name to import to be used by the source filter.
59
60=back
61
62=head1 DEPENDENCIES
63
64You will need L<Filter::Simple> and eventually L<Moose>
65
66=head1 INCOMPATIBILITIES
67
68None reported. But it is a source filter and might have issues there.
69
70=head1 BUGS
71
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.
75
76=head1 AUTHOR
77
78Chris Prather C<< <perigrin@cpan.org> >>
79
80=head1 COPYRIGHT AND LICENSE
81
82Copyright 2007-2009 by Infinity Interactive, Inc.
83
84L<http://www.iinteractive.com>
85
86This library is free software; you can redistribute it and/or modify
87it under the same terms as Perl itself.
88
89=cut