While trying to fix the test error in t/perl/Parrot_Distribution.t as
one of my cage cleaning duties, I found that this test fails because
the glob fails in Parrot::Distribution::is_perl_exemption(). This
happens because the current directory is changed to the test
directory (t/perl), rather than the parrot root directory, causing
the globbing on e.g. 'lib/Class/*' to fail.
One solution would be to create a hash with the absolute paths of
exempt Perl files as keys at module compile time, or at singleton
object creation time. The "is_perl_exemption" method would then
simply become a hash key lookup.
Another way would be to *not* use any globbing in determining the
list of exempt Perl files, but instead list all of the appropriate
files somewhere (similar to "is_c_exemption"), making
"get_perl_exemption_regexp" obsolete.
On the other hand, I think that both the "is_c_exemption" and
"is_perl_exemption" lookups are flawed as currently implemented, as
they only look at the last part of the complete filepaths. This is
most probably correct, but may produce false positives or negatives
(which is what the problem is now) when the current directory is
changed. Creating and storing absolute filenames at compile time of
the Parrot::Distribution module makes more sense to me, and would
allow for significantly more efficient tests.
Comments anyone?
Liz
- What is intended use of Parrot::Distribution? Elizabeth Mattijsen
-