[rt.cpan.org #106144] [Patch] Preload dependencies for File::BOM

[email protected] ("Shawn Laffan via RT")
Newsgroups perl.par
Message-ID <[email protected]>
Wed Jul 29 08:44:36 2015: Request 106144 was acted upon.
Transaction: Ticket created by SLAFFAN
       Queue: Module-ScanDeps
     Subject: [Patch] Preload dependencies for File::BOM
   Broken in: (no value)
    Severity: (no value)
       Owner: Nobody
  Requestors: [email protected]
      Status: new
 Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=106144 >


Dependency scanning when File::BOM is used in a via construct misses several dependencies, resulting in errors when calling PAR packed executables.  This particularly applies to CJK locales.

The attached patch adds a preload section to include them.  It could perhaps also load Encode::HanExtra and Encode::JIS2K, but I have not done so in this version.


The patch was tested using the code below.  The file open is needed to trigger the loading of the extra modules under "pp -x".

A more general solution might be to scan for "open .+?'<:via(\w+)'" constructs.

Regards,
Shawn.


use File::BOM;
open my $fh, '<:via(File::BOM)', $0  #  just read ourselves
  or die "Cannot open own code via File::BOM\n";
$fh->close;
ScanDeps.pm.FileBOM.patch (text/x-diff, 710 B)
Index: lib/Module/ScanDeps.pm
===================================================================
--- lib/Module/ScanDeps.pm	(revision 1595)
+++ lib/Module/ScanDeps.pm	(working copy)
@@ -331,6 +331,16 @@
         grep /\bMM_/, _glob_in_inc('ExtUtils', 1);
     },
     'File/Basename.pm' => [qw( re.pm )],
+    'File/BOM.pm'      => [
+        qw (
+            Encode/Unicode.pm
+            PerlIO/via.pm
+            Encode/CN.pm
+            Encode/JP.pm
+            Encode/KR.pm
+            Encode/TW.pm
+        )  #  load extra Encode pages just in case - should probably also do the extended ones
+    ],
     'File/HomeDir.pm' => 'sub',
     'File/Spec.pm'     => sub {
         require File::Spec;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.