Don't ask to ask, just ask | |
PerlMonks |
Re: @INC order not followedby ikegami (Patriarch) |
on Oct 19, 2022 at 19:17 UTC ( [id://11147522]=note: print w/replies, xml ) | Need Help?? |
The correct modules are being loaded. f CSV was simply too vague, matching multiple files. Let's start by looking at what f does.
You did not provide a full path, so you provided a regex. As it turns out, there were more than one match for the regex pattern CSV. /var/www/cgi-bin/project/CSV.pm matched. Your program also loads Text::CSV, so /usr/local/share/perl5/Text/CSV.pm matched as well. But there are at least two more matches. Text::CSV is not a CSV parser. It's a front end for Text::CSV_PP and Text::CSV_XS. It loads one of these modules, and it does so using an eval. This is the match you obtained. The eval that was used to load Text:CSV_XS (which is also a match). So that's four possible matches for your query, and I suspect you get one "at random". To get the correct file, first find out which one was loaded by a use/require. If you used the bareword syntax (use Foo or require Foo rather than require "Foo.pm"), first convert the bareword to a string using these rules: Replace every :: with / (even on Windows), then append .pm. Then look at the the value of the element of %INC that has that string for key.
Alternatively, you could perform the same search f CSV performs.
From there, you can use f
Finally, if your module was named My::CSV and stored as /var/www/cgi-bin/project/My/CSV.pm, you could have used since that only has one match.
In Section
Seekers of Perl Wisdom
|
|