sorry konobi, not enough of a perf win, so lets wait till we get something more befor...
[gitmo/Moose.git] / lib / oose.pm
1 package oose;
2 use strict;
3 use warnings;
4
5 our $VERSION   = '0.02';
6 our $AUTHORITY = 'cpan:STEVAN';
7
8 BEGIN {
9     my $package;
10     sub import { $package = $_[1] || 'Class' }
11     use Filter::Simple sub { s/^/package $package;\nuse Moose;\n/; }
12 }
13
14 1;
15
16 __END__
17
18 =pod
19
20 =head1 NAME
21
22 oose - syntactic sugar to make Moose one-liners easier
23
24 =head1 SYNOPSIS
25
26     perl -Moose=Foo -e 'has bar => ( is=>q[ro], default => q[baz] ); print Foo->new->bar' # prints baz
27
28 =head1 DESCRIPTION
29
30 oose.pm is a simple source filter that adds C<package $name; use Moose;> 
31 to the beginning of your script and was entirely created because typing 
32 perl -e'package Foo; use Moose; ...' was annoying me.
33
34 =head1 INTERFACE 
35
36 oose provides exactly one method and it's automically called by perl:
37
38 =over 4
39
40 =item B<import($package)>
41
42 Pass a package name to import to be used by the source filter.
43
44 =back
45
46 =head1 DEPENDENCIES
47
48 You will need L<Filter::Simple> and eventually L<Moose>
49
50 =head1 INCOMPATIBILITIES
51
52 None reported. But it is a source filter and might have issues there.
53
54 =head1 BUGS
55
56 All complex software has bugs lurking in it, and this module is no
57 exception. If you find a bug please either email me, or add the bug
58 to cpan-RT.
59
60 =head1 AUTHOR
61
62 Chris Prather  C<< <perigrin@cpan.org> >>
63
64 =head1 COPYRIGHT AND LICENSE
65
66 Copyright 2007-2008 by Infinity Interactive, Inc.
67
68 L<http://www.iinteractive.com>
69
70 This library is free software; you can redistribute it and/or modify
71 it under the same terms as Perl itself.
72
73 =cut