1File::Find::Object::RulUes:e:rExCtoenntdriinbgu(t3e)d PeFrilleD:o:cFuimnedn:t:aOtbijoenct::Rule::Extending(3)
2
3
4

VERSION

6       version 0.0311
7

SYNOPSIS

9           package File::Find::Object::Rule::Random;
10
11           use strict;
12           use warnings;
13
14           # take useful things from File::Find::Object::Rule
15           use base 'File::Find::Object::Rule';
16
17           # and force our crack into the main namespace
18           sub File::Find::Object::Rule::random () {
19               my $self = shift()->_force_object;
20               $self->exec( sub { rand > 0.5 } );
21           }
22
23           1;
24

DESCRIPTION

26       File::Find::Object::Rule inherits File::Find::Rule's extensibility. It
27       is now possible to extend it, using the following conventions.
28
29   Declare your package
30           package File::Find::Object::Rule::Random;
31
32           use strict;
33           use warnings;
34
35   Inherit methods from File::Find::Object::Rule
36           # take useful things from File::Find::Object::Rule
37           use base 'File::Find::Object::Rule';
38
39       Force your madness into the main package
40
41           # and force our crack into the main namespace
42           sub File::Find::Object::Rule::random () {
43               my $self = shift()->_force_object;
44               $self->exec( sub { rand > 0.5 } );
45           }
46
47       Yes, we're being very cavalier here and defining things into the main
48       File::Find::Object::Rule namespace.  This is due to lack of
49       imaginiation on my part - I simply can't find a way for the functional
50       and oo interface to work without doing this or some kind of
51       inheritance, and inheritance stops you using two
52       File::Find::Object::Rule::Foo modules together.
53
54       For this reason try and pick distinct names for your extensions.  If
55       this becomes a problem then I may institute a semi-official registry of
56       taken names.
57
58   Taking no arguments.
59       Note the null prototype on random.  This is a cheat for the procedural
60       interface to know that your sub takes no arguments, and so allows this
61       to happen:
62
63        find( random => in => '.' );
64
65       If you hadn't declared "random" with a null prototype it would have
66       consumed "in" as a parameter to it, then got all confused as it doesn't
67       know about a '.' rule.
68

NAME

70       File::Find::Object::Rule::Extending - the mini-guide to extending
71       File::Find::Object::Rule
72

NOTES ABOUT THE CALLBACK

74       The callback can access the File::Find::Object::Result using
75       "$self->finder->item_obj()".
76

AUTHOR

78       Richard Clamp <richardc@unixbeard.net>
79
81       Copyright (C) 2002 Richard Clamp.  All Rights Reserved.
82
83       This module is free software; you can redistribute it and/or modify it
84       under the same terms as Perl itself.
85

SEE ALSO

87       File::Find::Object::Rule
88
89       File::Find::::Rule::MMagic was the first extension module for
90       File::Find::Rule, so maybe check that out.
91

SUPPORT

93   Websites
94       The following websites have more information about this module, and may
95       be of help to you. As always, in addition to those websites please use
96       your favorite search engine to discover more resources.
97
98       ·   MetaCPAN
99
100           A modern, open-source CPAN search engine, useful to view POD in
101           HTML format.
102
103           <https://metacpan.org/release/File-Find-Object-Rule>
104
105       ·   Search CPAN
106
107           The default CPAN search engine, useful to view POD in HTML format.
108
109           <http://search.cpan.org/dist/File-Find-Object-Rule>
110
111       ·   RT: CPAN's Bug Tracker
112
113           The RT ( Request Tracker ) website is the default bug/issue
114           tracking system for CPAN.
115
116           <https://rt.cpan.org/Public/Dist/Display.html?Name=File-Find-Object-Rule>
117
118       ·   AnnoCPAN
119
120           The AnnoCPAN is a website that allows community annotations of Perl
121           module documentation.
122
123           <http://annocpan.org/dist/File-Find-Object-Rule>
124
125       ·   CPAN Ratings
126
127           The CPAN Ratings is a website that allows community ratings and
128           reviews of Perl modules.
129
130           <http://cpanratings.perl.org/d/File-Find-Object-Rule>
131
132       ·   CPANTS
133
134           The CPANTS is a website that analyzes the Kwalitee ( code metrics )
135           of a distribution.
136
137           <http://cpants.cpanauthors.org/dist/File-Find-Object-Rule>
138
139       ·   CPAN Testers
140
141           The CPAN Testers is a network of smoke testers who run automated
142           tests on uploaded CPAN distributions.
143
144           <http://www.cpantesters.org/distro/F/File-Find-Object-Rule>
145
146       ·   CPAN Testers Matrix
147
148           The CPAN Testers Matrix is a website that provides a visual
149           overview of the test results for a distribution on various
150           Perls/platforms.
151
152           <http://matrix.cpantesters.org/?dist=File-Find-Object-Rule>
153
154       ·   CPAN Testers Dependencies
155
156           The CPAN Testers Dependencies is a website that shows a chart of
157           the test results of all dependencies for a distribution.
158
159           <http://deps.cpantesters.org/?module=File::Find::Object::Rule>
160
161   Bugs / Feature Requests
162       Please report any bugs or feature requests by email to
163       "bug-file-find-object-rule at rt.cpan.org", or through the web
164       interface at
165       <https://rt.cpan.org/Public/Bug/Report.html?Queue=File-Find-Object-Rule>.
166       You will be automatically notified of any progress on the request by
167       the system.
168
169   Source Code
170       The code is open to the world, and available for you to hack on. Please
171       feel free to browse it and play with it, or whatever. If you want to
172       contribute patches, please send me a diff or prod me to pull from your
173       repository :)
174
175       <https://github.com/shlomif/http://bitbucket.org/shlomif/perl-file-find-object-rule>
176
177         git clone git://github.com/shlomif/http://bitbucket.org/shlomif/perl-file-find-object-rule.git
178

AUTHORS

180       ·   Richard Clamp <richardc@unixbeard.net>
181
182       ·   Andy Lester andy@petdance.com.
183

BUGS

185       Please report any bugs or feature requests on the bugtracker website
186       <https://github.com/shlomif/http://bitbucket.org/shlomif/perl-file-find-object-rule/issues>
187
188       When submitting a bug or request, please include a test-file or a patch
189       to an existing test-file that illustrates the bug or desired feature.
190
192       This software is copyright (c) 2019 by Richard Clamp.
193
194       This is free software; you can redistribute it and/or modify it under
195       the same terms as the Perl 5 programming language system itself.
196
197
198
199perl v5.30.0                      2019-08F-i2l6e::Find::Object::Rule::Extending(3)
Impressum