This file is indexed.

/usr/lib/perl5/Moose/Manual/MooseX.pod is in libmoose-perl 2.0401-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
package Moose::Manual::MooseX;

# ABSTRACT: Recommended Moose extensions



=pod

=head1 NAME

Moose::Manual::MooseX - Recommended Moose extensions

=head1 VERSION

version 2.0401

=head1 MooseX?

It's easy to extend and change Moose, and this is part of what makes
Moose so powerful. You can use the MOP API to do things your own way,
add new features, and generally customize your Moose.

Writing your own extensions does require a good understanding of the
meta-model. You can start learning about this with the
L<Moose::Manual::MOP> docs. There are also several extension recipes
in the L<Moose::Cookbook>.

Explaining how to write extensions is beyond the scope of this
manual. Fortunately, lots of people have already written extensions
and put them on CPAN for you.

This document covers a few of the ones we like best.

=head1 L<MooseX::AttributeHelpers>

The functionality of this MooseX module has been moved into Moose core.
See L<Moose::Meta::Attribute::Native>.

=head1 L<Moose::Autobox>

MooseX::AttributeHelpers, but turned inside out, Moose::Autobox provides
methods on both arrays/hashes/etc. but also references to them, using
Moose roles, allowing you do to things like:

  use Moose::Autobox;

  $somebody_elses_object->orders->push($order);

Lexically scoped and not to everybody's taste, but very handy for sugaring
up other people's APIs and your own code.

=head1 L<MooseX::StrictConstructor>

By default, Moose lets you pass any old junk into a class's
constructor. If you load L<MooseX::StrictConstructor>, your class will
throw an error if it sees something it doesn't recognize;

  package User;

  use Moose;
  use MooseX::StrictConstructor;

  has 'name';
  has 'email';

  User->new( name => 'Bob', emali => 'bob@example.com' );

With L<MooseX::StrictConstructor>, that typo ("emali") will cause a
runtime error. With plain old Moose, the "emali" attribute would be
silently ignored.

=head1 L<MooseX::Params::Validate>

We have high hopes for the future of L<MooseX::Method::Signatures> and
L<MooseX::Declare>. However, these modules, while used regularly in
production by some of the more insane members of the community, are
still marked alpha just in case backwards incompatible changes need to
be made.

If you don't want to risk that, for now we recommend the decidedly more
clunky (but also faster and simpler) L<MooseX::Params::Validate>. This
module lets you apply Moose types and coercions to any method
arguments.

  package User;

  use Moose;
  use MooseX::Params::Validate;

  sub login {
      my $self = shift;
      my ($password)
          = validated_list( \@_, password => { isa => 'Str', required => 1 } );

      ...
  }

=head1 L<MooseX::Getopt>

This is a role which adds a C<new_with_options> method to your
class. This is a constructor that takes the command line options and
uses them to populate attributes.

This makes writing a command-line application as a module trivially
simple:

  package App::Foo;

  use Moose;
  with 'MooseX::Getopt';

  has 'input' => (
      is       => 'ro',
      isa      => 'Str',
      required => 1
  );

  has 'output' => (
      is       => 'ro',
      isa      => 'Str',
      required => 1
  );

  sub run { ... }

Then in the script that gets run we have:

  use App::Foo;

  App::Foo->new_with_options->run;

From the command line, someone can execute the script:

  foo@example> foo --input /path/to/input --output /path/to/output

=head1 L<MooseX::Singleton>

To be honest, using a singleton is just a way to have a magic global
variable in languages that don't actually have global variables.

In perl, you can just as easily use a global. However, if your
colleagues are Java-infected, they might prefer a singleton. Also, if
you have an existing class that I<isn't> a singleton but should be,
using L<MooseX::Singleton> is the easiest way to convert it.

  package Config;

  use MooseX::Singleton; # instead of Moose

  has 'cache_dir' => ( ... );

It's that simple.

=head1 EXTENSIONS TO CONSIDER

There are literally dozens of other extensions on CPAN. This is a list
of extensions that you might find useful, but we're not quite ready to
endorse just yet.

=head2 L<MooseX::Declare>

Extends Perl with Moose-based keywords using C<Devel::Declare>. Very
cool, but still new and experimental.

  class User {

      has 'name'  => ( ... );
      has 'email' => ( ... );

      method login (Str $password) { ... }
  }

=head2 L<MooseX::Types>

This extension helps you build a type library for your application. It
also lets you predeclare type names and use them as barewords.

  use MooseX::Types -declare => ['PositiveInt'];
  use MooseX::Types::Moose 'Int';

  subtype PositiveInt,
      as Int,
      where { $_ > 0 },
      message { "Int is not larger than 0" };

One nice feature is that those bareword names are actually namespaced
in Moose's type registry, so multiple applications can use the same
bareword names, even if the type definitions differ.

=head2 L<MooseX::Types::Structured>

This extension builds on top of L<MooseX::Types> to let you declare
complex data structure types.

  use MooseX::Types -declare => [ qw( Name Color ) ];
  use MooseX::Types::Moose qw(Str Int);
  use MooseX::Types::Structured qw(Dict Tuple Optional);

  subtype Name
      => as Dict[ first => Str, middle => Optional[Str], last => Str ];

  subtype Color
      => as Tuple[ Int, Int, Int, Optional[Int] ];

Of course, you could always use objects to represent these sorts of
things too.

=head2 L<MooseX::ClassAttribute>

This extension provides class attributes for Moose classes. The
declared class attributes are introspectable just like regular Moose
attributes.

  package User;

  use Moose;
  use MooseX::ClassAttribute;

  has 'name' => ( ... );

  class_has 'Cache' => ( ... );

Note however that this class attribute does I<not> inherit like a
L<Class::Data::Inheritable> or similar attribute - calling

  $subclass->Cache($cache);

will set it for the superclass as well. Additionally, class data is usually
The Wrong Thing To Do in a strongly OO program since it makes testing a
lot harder - consider carefully whether you'd be better off with an object
that's passed around instead.

=head2 L<MooseX::Daemonize>

This is a role that provides a number of methods useful for creating a
daemon, including methods for starting and stopping, managing a PID
file, and signal handling.

=head2 L<MooseX::Role::Parameterized>

If you find yourself wanting a role that customizes itself for each
consumer, this is the tool for you. With this module, you can create a
role that accepts parameters and generates attributes, methods, etc. on
a customized basis for each consumer.

=head2 L<MooseX::POE>

This is a small wrapper that ties together a Moose class with
C<POE::Session>, and gives you an C<event> sugar function to declare
event handlers.

=head2 L<MooseX::FollowPBP>

Automatically names all accessors I<Perl Best Practices>-style,
"get_size" and "set_size".

=head2 L<MooseX::SemiAffordanceAccessor>

Automatically names all accessors with an explicit set and implicit
get, "size" and "set_size".

=head2 L<MooseX::NonMoose>

MooseX::NonMoose allows for easily subclassing non-Moose classes with Moose,
taking care of the annoying details connected with doing this, such as
setting up proper inheritance from Moose::Object and installing
(and inlining, at make_immutable time) a constructor that makes sure things
like BUILD methods are called.

=head1 AUTHOR

Moose is maintained by the Moose Cabal, along with the help of many contributors. See L<Moose/CABAL> and L<Moose/CONTRIBUTORS> for details.

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2011 by Infinity Interactive, Inc..

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

=cut


__END__