On Thu, Apr 8, 2021 at 2:59 PM Asher Gordon <asd...@posteo.net> wrote:
> 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. These are some interesting ideas but perhaps a bit too narrow in scope for this particular list (other than perhaps the naming of modules). There isn't a functional dzil mailing list anymore but you might consider joining #distzilla on irc.perl.org to have such in depth discussions: https://kiwiirc.com/client/irc.perl.org/distzilla -Dan