Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: Very Odd Issue When Using pp to Create an .exe File Including Date::Calc

by swl (Vicar)
on Jun 28, 2017 at 04:04 UTC ( #1193741=note: print w/replies, xml ) Need Help??

in reply to Very Odd Issue When Using pp to Create an .exe File Including Date::Calc

pp uses Module::ScanDeps to find dependencies, and it looks like it is not properly parsing lines containing /use\s+\d/

Using the current version of Module::ScanDeps:

perl -MModule::ScanDeps -e"print $Module::ScanDeps::VERSION" 1.23

and shortening the code somewhat:

use utf8; use strict; use List::Util qw(max); use Date::Calc qw(Delta_ +Days); use 42;

And then running it through scandeps.bat (in this case the code is in

scandeps 'Portable' => '1.22', 'File::Which' => '1.21', 'CryptX' => '0.044', 'Portable::CPAN' => '1.22', 'Portable::Config' => '1.22', 'Portable::HomeDir' => '1.22', 'Portable::LoadYaml' => '1.22', 'Portable::minicpan' => '1.22', 'Portable::FileSpec' => '1.22', 'File::HomeDir' => '1.00', 'File::HomeDir::Darwin::Carbon' => '1.00', 'File::HomeDir::Darwin::Cocoa' => '1.00', 'File::HomeDir::FreeDesktop' => '1.00', 'File::HomeDir::MacOS9' => '1.00', 'File::HomeDir::Test' => '1.00', 'File::HomeDir::Windows' => '1.00', 'File::HomeDir::Unix' => '1.00', 'File::HomeDir::Darwin' => '1.00', 'File::HomeDir::Driver' => '1.00', 'Math::BigInt::GMP' => '1.6003', 'Math::BigInt::LTM' => '0.044',

The above also does not list List::Util, but that can be done using the -B flag in the call

In fact, the issue also manifests in one-liners as these two are also missing Date::Calc in their outputs:

scandeps -e"use 5.022; use Date::Calc" scandeps -e"use Date::Calc; use 5.022"

But on further checking, it is triggered for any value >= 5.01

These list Date::Calc and Date::Calc::PP

scandeps -e"use 5.009; use Date::Calc" scandeps -e"use 4; use Date::Calc"

This does not:

scandeps -e"use 5.01; use Date::Calc"

And for general reference:

scandeps -e"use 5.009;" No modules found!

It can also be reproduced using other modules. This one-liner does not list Text::CSV_XS.

scandeps -e"use 5.01; use Text::CSV_XS"

It is probably worth raising as a Module::ScanDeps issue.

Replies are listed 'Best First'.
Re^2: Very Odd Issue When Using pp to Create an .exe File Including Date::Calc
by perldigious (Priest) on Jun 28, 2017 at 15:11 UTC

    Wow, well done swl, I'm glad someone dug in to sniff out where/what the issue was (I seriously doubt I'm up to the task at my capability level, I'm just one of those Perl "lusers" :-) ). I'd give you all my ++ for the day on this if I could.

    Just another Perl hooker - But the purist monks keep telling me I should do it for love, not money.

      No worries perldigious.

      As haukex noted, Module::ScanDeps is a regexp based parser so it's perhaps not surprising that it misses some things when parsing perl code.

      That said, I had a quick look at the Module::ScanDeps code and it's probably in scan_line where it does an early return while processing semicolon separated chunks and it finds a chunk where a perl version >= 5.9.5 is being used (currently line 812). When it finds a matching chunk it returns and thus stops processing the rest of the line. It should probably add to %found and call next instead.

      There looks to be a similar issue in the following block where it handles pragmas.

      If I get a chance I'll submit a pull request to the github repo, but others are welcome to beat me to it as it won't be today.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1193741]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (2)
As of 2022-05-18 22:45 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (71 votes). Check out past polls.