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

NAME

6       File::Find::Object::Rule::Extending - the mini-guide to extending
7       File::Find::Object::Rule
8

VERSION

10       version 0.0310
11

SYNOPSIS

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

DESCRIPTION

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

VERSION

74       version 0.0310
75

NOTES ABOUT THE CALLBACK

77       The callback can access the File::Find::Object::Result using
78       "$self->finder->item_obj()".
79

AUTHOR

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

SEE ALSO

90       File::Find::Object::Rule
91
92       File::Find::::Rule::MMagic was the first extension module for
93       File::Find::Rule, so maybe check that out.
94

AUTHORS

96       ·   Richard Clamp <richardc@unixbeard.net> with input gained from this
97
98       ·   and Andy Lester andy@petdance.com.
99
101       This software is copyright (c) 2019 by Richard Clampwith input gained
102       from this.
103
104       This is free software; you can redistribute it and/or modify it under
105       the same terms as the Perl 5 programming language system itself.
106

BUGS

108       Please report any bugs or feature requests on the bugtracker website
109       <https://github.com/shlomif/file-find-object-rule/issues>
110
111       When submitting a bug or request, please include a test-file or a patch
112       to an existing test-file that illustrates the bug or desired feature.
113

SUPPORT

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