Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Data-Compare CPAN distribution.

Report information
The Basics
Id: 32235
Status: resolved
Priority: 0/
Queue: Data-Compare

People
Owner: Nobody in particular
Requestors: dmuey [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.17
Fixed in: (no value)



Subject: inefficient startup
A bit of how this module could be improved greatly by a small change: just by use()ing or require()ing the module it runs _register_plugins() which does a File::Find::Rule on @INC This should be done by a flag to use() or at least done in import() so that if we know we don't want any plugins we can require it to avoid the uber filesystem overhead that we won't be using any way. maybe change the use File::Find::Rule; to a require() so that it also is only loaded if we're doing the _register_plugins() bit (maybe put that require in _register_plugins ?) Danke :)
Here's a patch for, if nothing else, an example of what I'm talking about
Index: Data/Compare.pm =================================================================== --- Data/Compare.pm (revision 017) +++ Data/Compare.pm (revision 018) @@ -20,14 +20,17 @@ my %handler; -use Cwd; -if(eval { chdir(getcwd()) }) { # chdir(getcwd()) is Bad in taint mode - use File::Find::Rule; - _register_plugins(); + +sub import { + use Cwd; # if this is the only use of it, then require it here instead + if(eval { chdir(getcwd()) }) { # chdir(getcwd()) is Bad in taint mode + _register_plugins(); + } } # finds and registers plugins sub _register_plugins { + require File::Find::Rule; # do it here so _register_plugins can be called foreach my $file ( File::Find::Rule ->file()
The fix you provided won't work, cos it tramples over the inherited import() method. I've not noticed start-up being made slow, but even so, the idea of being able to not load plugins is a good one, so I've implemented what you suggested anyway. See version 1.18 on the CPAN shortly.