1oose(3) User Contributed Perl Documentation oose(3)
2
3
4
6 oose - syntactic sugar to make Moose one-liners easier
7
9 version 2.2012
10
12 # create a Moose class on the fly ...
13 perl -Moose=Foo -e 'has bar => ( is=>q[ro], default => q[baz] ); print Foo->new->bar' # prints baz
14
15 # loads an existing class (Moose or non-Moose)
16 # and re-"opens" the package definition to make
17 # debugging/introspection easier
18 perl -Moose=+My::Class -e 'print join ", " => __PACKAGE__->meta->get_method_list'
19
20 # also loads Moose::Util::TypeConstraints to allow subtypes etc
21 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)'
22
24 oose.pm is a simple source filter that adds "package $name; use Moose;
25 use Moose::Util::TypeConstraints;" to the beginning of your script and
26 was entirely created because typing "perl -e'package Foo; use Moose;
27 ...'" was annoying me.
28
30 oose provides exactly one method and it's automatically called by perl:
31
32 import($package)
33 Pass a package name to import to be used by the source filter. The
34 package defaults to "Class" if none is given.
35
37 You will need Filter::Simple and eventually Moose
38
40 None reported. But it is a source filter and might have issues there.
41
43 See "BUGS" in Moose for details on reporting bugs.
44
46 · Stevan Little <stevan.little@iinteractive.com>
47
48 · Dave Rolsky <autarch@urth.org>
49
50 · Jesse Luehrs <doy@tozt.net>
51
52 · Shawn M Moore <code@sartak.org>
53
54 · יובל קוג'מן (Yuval Kogman) <nothingmuch@woobling.org>
55
56 · Karen Etheridge <ether@cpan.org>
57
58 · Florian Ragwitz <rafl@debian.org>
59
60 · Hans Dieter Pearcey <hdp@weftsoar.net>
61
62 · Chris Prather <chris@prather.org>
63
64 · Matt S Trout <mst@shadowcat.co.uk>
65
67 This software is copyright (c) 2006 by Infinity Interactive, Inc.
68
69 This is free software; you can redistribute it and/or modify it under
70 the same terms as the Perl 5 programming language system itself.
71
72
73
74perl v5.30.1 2020-01-30 oose(3)