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.0313
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       •   RT: CPAN's Bug Tracker
106
107           The RT ( Request Tracker ) website is the default bug/issue
108           tracking system for CPAN.
109
110           <https://rt.cpan.org/Public/Dist/Display.html?Name=File-Find-Object-Rule>
111
112       •   CPANTS
113
114           The CPANTS is a website that analyzes the Kwalitee ( code metrics )
115           of a distribution.
116
117           <http://cpants.cpanauthors.org/dist/File-Find-Object-Rule>
118
119       •   CPAN Testers
120
121           The CPAN Testers is a network of smoke testers who run automated
122           tests on uploaded CPAN distributions.
123
124           <http://www.cpantesters.org/distro/F/File-Find-Object-Rule>
125
126       •   CPAN Testers Matrix
127
128           The CPAN Testers Matrix is a website that provides a visual
129           overview of the test results for a distribution on various
130           Perls/platforms.
131
132           <http://matrix.cpantesters.org/?dist=File-Find-Object-Rule>
133
134       •   CPAN Testers Dependencies
135
136           The CPAN Testers Dependencies is a website that shows a chart of
137           the test results of all dependencies for a distribution.
138
139           <http://deps.cpantesters.org/?module=File::Find::Object::Rule>
140
141   Bugs / Feature Requests
142       Please report any bugs or feature requests by email to
143       "bug-file-find-object-rule at rt.cpan.org", or through the web
144       interface at
145       <https://rt.cpan.org/Public/Bug/Report.html?Queue=File-Find-Object-Rule>.
146       You will be automatically notified of any progress on the request by
147       the system.
148
149   Source Code
150       The code is open to the world, and available for you to hack on. Please
151       feel free to browse it and play with it, or whatever. If you want to
152       contribute patches, please send me a diff or prod me to pull from your
153       repository :)
154
155       <https://github.com/shlomif/http://bitbucket.org/shlomif/perl-file-find-object-rule>
156
157         git clone git://github.com/shlomif/http://bitbucket.org/shlomif/perl-file-find-object-rule.git
158

AUTHORS

160       •   Richard Clamp <richardc@unixbeard.net>
161
162       •   Andy Lester andy@petdance.com.
163

BUGS

165       Please report any bugs or feature requests on the bugtracker website
166       <https://github.com/shlomif/http://bitbucket.org/shlomif/perl-file-find-object-rule/issues>
167
168       When submitting a bug or request, please include a test-file or a patch
169       to an existing test-file that illustrates the bug or desired feature.
170
172       This software is copyright (c) 2021 by Richard Clamp.
173
174       This is free software; you can redistribute it and/or modify it under
175       the same terms as the Perl 5 programming language system itself.
176
177
178
179perl v5.36.0                      2023-01F-i2l0e::Find::Object::Rule::Extending(3)
Impressum