Skip Menu |

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

Report information
The Basics
Id: 71346
Status: resolved
Priority: 0/
Queue: Data-Random

People
Owner: BAREFOOT [...] cpan.org
Requestors: BAREFOOT [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.05
Fixed in: 0.06



Subject: Pointless use of `use lib qw(..)'
Polluting the user's @INC is never a good thing. Here's the situation I just ran into: *) We have a Foo::Bar module, which lives in our project at lib/Foo/Bar.pm. *) We also have a Test::Foo::Bar module, which is a thin wrapper around Foo::Bar for unit test purposes. It lives, of course, at lib/Test/Foo/Bar.pm. *) Test::Foo::Bar, naturally enough, contains a `use Foo::Bar' line. *) In lib/Test, there is a t/ subdir where there are unit tests. *) I happened to be in lib/Test/t, running a unit test, which happened to do a `use Test::Foo::Bar' (actually, it included something else which did that, but same principle). *) Because I was also doing a `use Data::Random', and because it just so happened that my `use Data::Random' was before my `use Test::Foo::Bar', when perl got to the `use Foo::Bar' inside lib/Test/Foo/Bar.pm, it actually included itself. *) With the result that lib/Foo/Bar.pm was never loaded and code started failing in very odd ways. *) As you can imagine, this took two engineers and a couple of hours to track down. So, besides the general rule that mucking with @INC for no particular reason is a Bad Thing(tm), this is very specifically causing me some heartburn at the moment. It seems like just removing the single line `use lib qw(..)' from the top of Data/Random.pm would take care of the problem. Thanks for your attention.
Took over maintenance and fixed the bug.