1oose(3) User Contributed Perl Documentation oose(3)
2
3
4
6 oose - syntactic sugar to make Moose one-liners easier
7
9 # create a Moose class on the fly ...
10 perl -Moose=Foo -e 'has bar => ( is=>q[ro], default => q[baz] ); print Foo->new->bar' # prints baz
11
12 # loads an existing class (Moose or non-Moose)
13 # and re-"opens" the package definition to make
14 # debugging/introspection easier
15 perl -Moose=+My::Class -e 'print join ", " => __PACKAGE__->meta->get_method_list'
16
17 # also loads Moose::Util::TypeConstraints to allow subtypes etc
18 perl -Moose=Person -e'subtype q[ValidAge] => as q[Int] => where { $_ > 0 && $_ < 78 }; has => age ( isa => q[ValidAge], is => q[ro]); Person->new(age => 90)'
19
21 oose.pm is a simple source filter that adds "package $name; use Moose;"
22 to the beginning of your script and was entirely created because typing
23 "perl -e'package Foo; use Moose; ...'" was annoying me.
24
26 oose provides exactly one method and it's automatically called by perl:
27
28 import($package)
29 Pass a package name to import to be used by the source filter.
30
32 You will need Filter::Simple and eventually Moose
33
35 None reported. But it is a source filter and might have issues there.
36
38 See "BUGS" in Moose for details on reporting bugs.
39
41 Chris Prather "<chris@prather.org>"
42
44 Copyright 2007-2009 by Infinity Interactive, Inc.
45
46 <http://www.iinteractive.com>
47
48 This library is free software; you can redistribute it and/or modify it
49 under the same terms as Perl itself.
50
51
52
53perl v5.12.2 2010-08-28 oose(3)