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.0312
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

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       •   CPAN Ratings
119
120           The CPAN Ratings is a website that allows community ratings and
121           reviews of Perl modules.
122
123           <http://cpanratings.perl.org/d/File-Find-Object-Rule>
124
125       •   CPANTS
126
127           The CPANTS is a website that analyzes the Kwalitee ( code metrics )
128           of a distribution.
129
130           <http://cpants.cpanauthors.org/dist/File-Find-Object-Rule>
131
132       •   CPAN Testers
133
134           The CPAN Testers is a network of smoke testers who run automated
135           tests on uploaded CPAN distributions.
136
137           <http://www.cpantesters.org/distro/F/File-Find-Object-Rule>
138
139       •   CPAN Testers Matrix
140
141           The CPAN Testers Matrix is a website that provides a visual
142           overview of the test results for a distribution on various
143           Perls/platforms.
144
145           <http://matrix.cpantesters.org/?dist=File-Find-Object-Rule>
146
147       •   CPAN Testers Dependencies
148
149           The CPAN Testers Dependencies is a website that shows a chart of
150           the test results of all dependencies for a distribution.
151
152           <http://deps.cpantesters.org/?module=File::Find::Object::Rule>
153
154   Bugs / Feature Requests
155       Please report any bugs or feature requests by email to
156       "bug-file-find-object-rule at rt.cpan.org", or through the web
157       interface at
158       <https://rt.cpan.org/Public/Bug/Report.html?Queue=File-Find-Object-Rule>.
159       You will be automatically notified of any progress on the request by
160       the system.
161
162   Source Code
163       The code is open to the world, and available for you to hack on. Please
164       feel free to browse it and play with it, or whatever. If you want to
165       contribute patches, please send me a diff or prod me to pull from your
166       repository :)
167
168       <https://github.com/shlomif/http://bitbucket.org/shlomif/perl-file-find-object-rule>
169
170         git clone git://github.com/shlomif/http://bitbucket.org/shlomif/perl-file-find-object-rule.git
171

AUTHORS

173       •   Richard Clamp <richardc@unixbeard.net>
174
175       •   Andy Lester andy@petdance.com.
176

BUGS

178       Please report any bugs or feature requests on the bugtracker website
179       <https://github.com/shlomif/http://bitbucket.org/shlomif/perl-file-find-object-rule/issues>
180
181       When submitting a bug or request, please include a test-file or a patch
182       to an existing test-file that illustrates the bug or desired feature.
183
185       This software is copyright (c) 2020 by Richard Clamp.
186
187       This is free software; you can redistribute it and/or modify it under
188       the same terms as the Perl 5 programming language system itself.
189
190
191
192perl v5.32.1                      2021-01F-i2l7e::Find::Object::Rule::Extending(3)
Impressum