Subject: | Possible bug or misleading documentation. |
Date: | Tue, 24 Jan 2006 10:52:15 -0500 |
To: | bug-Module-ScanDeps [...] rt.cpan.org |
From: | Stephen Schulze <smschulze [...] erols.com> |
In version .54 (and possibly earlier versions) the documentation states
that the hash
returned by scan_deps() contains an array that holds the name of the
file that called
that module.
$hash_ref->{key}{used_by}['filename',...]
The documentation does not state that that array holds the names of ALL
the files
that called that module, though it implies it. (Why else would you need
an array?)
In actual use however, the array only ends up containing the name of the
FIRST
module that called it. Now for the purposes of locating dependencies,
this is
sufficient, if ANY file calles the module, it needs to be included.
However, I wanted
to use this module to find ALL the files that call each module. :-(
(Actually, I wanted
to locate modules that were loaded from more than one location, so I was
looking
for arrays > 1.)
After looking at the code a bit, it seems like it would be a minor
change to get that
functionality working. Changing line #664 in version .54 from
next if exists $rv->{$module};
to
_add_info($rv, undef, undef, $used_by, undef) and next if exists
$rv->{$module};
seems to work without undue difficulty.
It would seem that either changing that line to include the other
calling files, or at least
modifying the documentaion to make it clear that the used_by array only
contains the
first instance would be a good idea.
Thanks
An appreciative user,
Stephen Schulze