Glenn Linderman schrieb:
I went back to my archive of PAR email to rediscover and reconfirm all
the history of the PAR_TEMP and related variables. Interesting reading.
... and confusing if you ask me. I really, really appreciate the work
you've done with this. I assume it took quite a while to do that. Thanks!
So I'm also reading code to confirm my understanding of these variables
as I document them, and I came across the loop at par.pl line 623 that
starts:
foreach my $member ( $zip->members ) {
next if $member->isDirectory or !$ENV{PAR_TEMP};
It seems like it would be more efficient to hoist the !$ENV{PAR_TEMP}
out of that first condition, by placing
if ( $ENV{PAR_TEMP} ) {
as a precondition for the loop. I kind of doubt that it is possible for
PAR_TEMP not to be set at this point, but it would be more efficient to
avoid the check inside the loop for each file found... in fact, it would
even avoid calling $zip->members and enumerating all the files, if
nothing is to be done with them.
I agree with you that PAR_TEMP will be set at this point. Assuming it
is, the code above isn't really doing a lot of extra work because the
penalty of $member->isDirectory is *much* bigger than !$ENV{PAR_TEMP}.
Regardless, since nothing in the loop can possibly set PAR_TEMP, it's
sensible to move the conditional outside the loop. If, for some unknown
reason, PAR_TEMP isn't set at that point, it could even provide a
noticeable speedup. I'll change that now.
It seems that the POD in par.pm explains the PAR_TEMP directory
calculation quite well... in the NOTES section... except the explanation
on line 173 of that file should have been PAR_GLOBAL_CLEAN instead of
PAR_CLEAN. I've changed that.
Also the description of I<TEMP> in par.pm is a little inappropriate.
PAR_GLOBAL_TMPDIR contributes to TEMP, but not PAR_TMPDIR (it is just an
intermediate variable). I've changed that, too.
Good!
I'm documenting all the variables that contribute to PAR_TEMP
calculation as "contributes to the calculation of PAR_TEMP", and
referring to the "pod for par.pm" for the complete explanation. I'm no
pod expert, so I don't know the correct way to frame the reference, but
it is only under PAR_TEMP at this point.
Alternately, that explanation could be copied to the PAR_TEMP section of
Environment.pod, if you think that would be better.
My changes are revision 325 ... as my first attempt at actually changing
any of the files of PAR, I'll not be upset if anyone wishes to change
things -- I'd appreciate discussion here though, so I can learn. And
I'm happy to make more changes if particular suggestions are given.
I changed par.pm to PAR.pm in one place, but apart from that, your
changes are fine. Links can be done as L<PAR> to refer to the docs of
PAR.pm. But whether one does L<PAR> or points at "the documentation of
PAR.pm" is really not a big deal.
Steffen