develooper Front page | perl.module-authors | Postings from April 2021

Prereq scanners for Dist::Zilla and Pod::Weaver plugin bundles

Thread Next
From:
Asher Gordon
Date:
April 8, 2021 18:59
Subject:
Prereq scanners for Dist::Zilla and Pod::Weaver plugin bundles
Message ID:
87lf9s8uwr.fsf@posteo.net
Hello,

As I've already mentioned, I've Dist::Zilla and Pod::Weaver plugin
bundles for use in my projects
(Dist::Zilla::PluginBundle::Author::ASDAGO and
Pod::Weaver::PluginBundle::Author::ASDAGO). However, I noticed that
prerequisites on other plugins and plugin bundles are not detected by
AutoPrereqs. As far as I could tell, there didn't exist any scanners for
Perl::PrereqScanner that could scan Dist::Zilla and Pod::Weaver plugin
bundles, so I wrote my own.

So far, they work pretty well (the Dist::Zilla one currently only works
on Dist::Zilla::Role::PluginBundle::Easy plugin bundles). My working
names for them are Perl::PrereqScanner::Scanner::PluginBundle::DistZilla
and Perl::PrereqScanner::Scanner::PluginBundle::PodWeaver. Are these
names satisfactory? I was also thinking something like
Perl::PrereqScanner::Scanner::DistZillaPluginBundle in case they would
get confused as plugin bundles for Perl::PrereqScanner itself. What do
you think? Also, I think that they're different enough to release as
separate packages.

Another thing is, the Pod::Weaver plugin bundle scanner works by looking
for any anonymous array references of three elements where the last one
is an anonymous hash reference. Since plugins could be stored in
variables before they are returned from mvp_bundle_config() (indeed,
these seems to usually be the case), this is really the only reasonably
reliable method of detecting prerequisites short of actually running the
file.

Unfortunately, this also means there are sometimes false positives. For
example, in RJBS's Dist::Zilla plugin bundle, my Pod::Weaver plugin
bundle scanner detects two false positives:
Pod::Weaver::Section::CPAN-Outdated and
Pod::Weaver::Section::RJBS-Outdated. This is because they are specified
to add_plugins() as an anonymous array reference of three elements with
the last one being an anonymous hash reference, which, you will recall,
is exactly what my Pod::Weaver plugin bundle scanner looks for.

Of course, the Pod::Weaver plugin bundle scanner should not be run on a
Dist::Zilla plugin bundle, but since RJBS's Dist::Zilla and Pod::Weaver
plugin bundles are packaged together (which is what I was planning to do
with my plugin bundles, though I may rethink that), I don't think it's
possible (correct me if I'm wrong) to use different scanners for each
file with the AutoPrereqs plugin. One solution would be to write another
plugin similar to AutoPrereqs, but that allows per-file scanners to be
specified. Another (perhaps better) solution would be to package the
Dist::Zilla and Pod::Weaver plugin bundles separately, and use a
different scanner for each package. Let me know if you have any opinions
on how that should be done.

Sorry for the long message (especially the first sentence of the fifth
(previous) paragraph), and thanks for any help.

Asher

-- 
If for every rule there is an exception, then we have established that there
is an exception to every rule.  If we accept "For every rule there is an
exception" as a rule, then we must concede that there may not be an exception
after all, since the rule states that there is always the possibility of
exception, and if we follow it to its logical end we must agree that there
can be an exception to the rule that for every rule there is an exception.
		-- Bill Boquist
                               --------
I prefer to send and receive mail encrypted. Please send me your
public key, and if you do not have my public key, please let me
know. Thanks.

GPG fingerprint: 38F3 975C D173 4037 B397  8095 D4C9 C4FC 5460 8E68

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About