Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Can module building tools deal with .pl files in lib/

by Smonff (Acolyte)
on Sep 11, 2020 at 20:10 UTC ( #11121632=perlquestion: print w/replies, xml ) Need Help??

Smonff has asked for the wisdom of the Perl Monks concerning the following question:

I am playing with Zydeco and have a lot of questions those days.

Not related to Zydeco, but this is a question that came because of the tests I did with it. This is more about the usual authoring and module building tools. I usually use Minilla because it is high level and it made my life super simple for something like 3 years, but I just encountered an issue. I then read the documentation of at least:

  • Module::Build::Tiny
  • Module::Build
...but didn't find an answer. I guess it would be easier to ask some fellow monks.

So there is a very abnormal situation: I have .pl files in lib/. I know this is weird and not recommended, but I am using a third party tool from a rather experienced CPAN author, so I guess this is on my side that there is a problem. My files and directory tree looks like the following:

$ tree ./lib/ ./lib/ Art Abstractions.pl Wildlife/ Buyer.pl Collector.pl Wildlife.pm World.pm Art.pm

The reason that there are some .pl files in this area is something imposed by Zydeco (as far as I can understand) when you want to include some classes or roles. I don't want to open a debate on this, this is how things are. My tests are passing fine when I do something like prove -l t/.

The issue starts to happen when I enter some traditional building and authoring. I first used Minilla, and then Module::Build::Tiny. Here is the output:

$ mbtiny test Creating new 'Build' script for 'Art-World' version '0.06' cp lib/Art.pm blib/lib/Art.pm cp script/art.pl blib/script/art.pl cp lib/Art/World.pm blib/lib/Art/World.pm cp lib/Art/Wildlife.pm blib/lib/Art/Wildlife.pm t/01-basic.t .......... ok t/02-entities.t ....... No such file: Art/Wildlife/Buyer.pl at /tmp/ +WcGB64xtpH/blib/lib/Art/Wildlife.pm line 5. BEGIN failed--compilation aborted at /tmp/WcGB64xtpH/blib/lib/Art/Wi +ldlife.pm line 5. Compilation failed in require at t/02-entities.t line 3. BEGIN failed--compilation aborted at t/02-entities.t line 3. t/02-entities.t ....... Dubious, test returned 255 (wstat 65280, 0xf +f00) No subtests run Test Summary Report ------------------- t/02-entities.t (Wstat: 65280 Tests: 0 Failed: 0) Non-zero exit status: 255 Parse errors: No plan found in TAP output Files=5, Tests=1, 0 wallclock secs ( 0.03 usr 0.01 sys + 0.48 cus +r 0.04 csys = 0.56 CPU) Result: FAIL
All the different modules building and authoring tools gave me the same result: .pl files in lib/ are not copied to the build area and cannot be found. I dunno what to do with this situation and despite of searching in various configuration parameters, I didn't find promising paths. I guess I am missing something, but dunno what?

Replies are listed 'Best First'.
Re: Can module building tools deal with .pl files in lib/
by perlfan (Priest) on Sep 11, 2020 at 20:32 UTC
    Your build tool should be able to be told to copy certain files and where to put them, so you just need to figure out how to do that. What are you using? Dist::Zilla?

    Update - oh I see, Minilla. Looks cool, never used it. It might not do what you need based on this,

    Minilla sets install script files as ['script/*', 'bin/*'] by default.
    
    (Note. This option doesn't affect anything if you are using ModuleBuildTiny or ExtUtilsMakeMaker, for now. If you are using ModuleBuildTiny, you MUST put scripts in script/ directory.)
    

    If it's true it can't handle your use case, there might be a way to do as a pre-step. But really, I think you already recognize the fact that you should figure out the root issue - don't use .pl when it should be .pm.

Re: Can module building tools deal with .pl files in lib/ ( Module::Build add_build_element )
by Anonymous Monk on Sep 16, 2020 at 03:10 UTC

    https://metacpan.org/pod/Module::Build::Cookbook#Adding-new-file-types-to-the-build-process

    $builder->add_build_element(q/pl/);

    $ module-starter --module DotPlInLib --email email --author author --v +erbose --mb Created DotPlInLib Created DotPlInLib\lib Created DotPlInLib\lib\DotPlInLib.pm Created DotPlInLib\t Created DotPlInLib\t\pod-coverage.t Created DotPlInLib\t\pod.t Created DotPlInLib\t\manifest.t Created DotPlInLib\t\00-load.t Created DotPlInLib\xt Created DotPlInLib\xt\boilerplate.t Created DotPlInLib\ignore.txt Created DotPlInLib\Build.PL Created DotPlInLib\Changes Created DotPlInLib\README Added to MANIFEST: Build.PL Added to MANIFEST: Changes Added to MANIFEST: ignore.txt Added to MANIFEST: lib/DotPlInLib.pm Added to MANIFEST: MANIFEST Added to MANIFEST: README Added to MANIFEST: t/00-load.t Added to MANIFEST: t/manifest.t Added to MANIFEST: t/pod-coverage.t Added to MANIFEST: t/pod.t Added to MANIFEST: xt/boilerplate.t Created DotPlInLib\MANIFEST Created starter directories and files $ cd DotPlInLib $ md lib\DotPlInLib\ $ echo sub yo { 42 } > lib\yo.pl $ echo sub yo { 42 } > lib\DotPlInLib\yo.pl $ echo sub no { 42 } > no.pl $ perl -pi.orig -e "s{^(\$builder->)}{${1}add_build_element(q/pl/);;$1 +} " Build.PL $ perl Build.PL --install_base .deleteme/ Created MYMETA.yml and MYMETA.json Creating new 'Build' script for 'DotPlInLib' version '0.01' $ perl Build install Building DotPlInLib Installing .deleteme\lib\perl5\DotPlInLib.pm Installing .deleteme\lib\perl5\yo.pl Installing .deleteme\lib\perl5\DotPlInLib\yo.pl

      This is magnificent.

      🌸
Re: Can module building tools deal with .pl files in lib/
by Anonymous Monk on Sep 11, 2020 at 21:50 UTC
    Of course they can. It even used to be default decades ago. But for zydeco/tobyink to demand/impose .pl files in lib? I doubt it. Will look into this when im not on mobile.

      Yep, Zydeco can use .pl files in lib. I wasn't aware this caused issues for any build tools. I'll need to look into it.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://11121632]
Approved by marto
Front-paged by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2020-09-20 08:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If at first I don’t succeed, I …










    Results (120 votes). Check out past polls.

    Notices?