Hi Roderich,
CC'ing because my mails seem to take a long time to show up on @perl.org
mailing lists. My return address isn't subscribed.
Roderich Schupp wrote:
- If any repository that's checked for a particular module has it, the
corresponding par file will be downloaded to the computer and loaded with
PAR. Therefore, it'll feed back into the @PAR_INC or @PAR_INC_LAST lists of
loaded pars at that point (see above).
How does that "feeding back into @PAR_INC or @PAR_INC_LAST" work?
I don't see where these are augmented except during PAR.pm's import processing.
That's exactly it. PAR::Repository::Client does this to the downloaded
.par archives: (Client.pm, line 413)
PAR->import( { file => $local_par_file, fallback => ($fallback?1:0) } );
PAR::import pushes the Archive::Zip handles to @PAR_INC or @PAR_INC_LAST
depending on $fallback.
Also, can you explain the following call (in find_par() and find_par_last()):
_find_par_internals([$PAR_INC_LAST[-1]], @args);
What's so special about the last element of @PAR_INC_LAST?
The syntax for _find_par_internals is:
_find_par_internals(
$ary_ref_of_archive_zip_handles,
@stuff_that_relates_to_how_INC_hooks_are_called
);
Let's leave aside upgrading for a moment. It's
_find_par_internals([$PAR_INC[-1]], @args);
in find_par after having just loaded a new .par from a "fallback=>0"
repository. Which means the repository client called
PAR->import({file=>...,fallback=>0}). That call appended the new handle
to the @PAR_INC array. Thus, by selecting the last element, we get the
new A::Zip handle!
Similarly, it's
_find_par_internals([$PAR_INC_LAST[-1]], @args);
in find_par_last after having just (successfully) downloaded and
imported a new PAR archive from a fallback=>1 repository.
The oddball is the case of upgrade-repositories. Those get treated in
find_par (i.e. early in @INC) because they need to override anything on
disk if necessary.
This made me discover two more bugs. It's getting a bit embarrassing...
The wrong logic was: If a PAR archive has been loaded from an
upgrade-repository, it's appended to the fallback list of PAR archives
(wrong, it's not and should be. It's been installed if necessary and
loaded from disk regardless!)
The fix should be to simply remove the "if
($local_file){..._find_par_internals...}" code.
The other bug was that the priority/fallback=>0 repositories weren't
beeing disabled for the "system-local" require() in upgrade_module. This
is fixed in trunk now. Added a local $PAR::PriorityRepositories. A beer
for whoever manages to add tests for that!
Sorry for not getting back earlier on this, got distracted by work :)
I know how that feels!
Cheers,
Steffen