Re: Can't find function in @INC
by amon (Scribe) on May 04, 2014 at 18:28 UTC
|
You are absolutely correct. The error “Can't locate Module.pm in @INC” exists, but AFAIK no such error message referring to functions does. So there are two and a half possibilities:
- It is a trick question to test your knowledge of Perl. Explain how a similar error regarding modules does exist, and what the role of @INC is.
- The question contains a mistake. This is the most likely explanation, considering that perldiag has no entry for such an error message.
- There is some surprising new behavior in Perl which neither you nor I am not aware of. While possible, this isn't exactly the most likely explanation.
| [reply] [d/l] |
|
|
> This is the most likely explanation, considering that perldiag has no entry for such an error message.
hmm did you notice that Can't locate Module.pm in @INC is not in perldiag?
The corresponding error is only called Can't locate %s
Which means searching for '@INC' wouldn't help...
Though you're right about the full message:
perl -Mdiagnostics -Mdummy
Can't locate dummy.pm in @INC (@INC contains: /etc/perl /usr/local/lib
+/perl/5.10.0 /usr/local/share/perl/5.10.0 /usr/lib/perl5 /usr/share/p
+erl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl
+ .).
BEGIN failed--compilation aborted (#1)
(F) You said to do (or require, or use) a file that couldn't be
found. Perl looks for the file in all the locations mentioned in @
+INC,
unless the file name included the full path to the file. Perhaps
+you
need to set the PERL5LIB or PERL5OPT environment variable to say w
+here
the extra library is, or maybe the script needs to add the library
+ name
to @INC. Or maybe you just misspelled the name of the file. See
perlfunc/require and lib.
Cheers Rolf
( addicted to the Perl Programming Language)
| [reply] [d/l] [select] |
|
|
Can't locate Module.pm in @INC
Can't locate Module.pm in @INC (#1)
(F) You said to do (or require, or use) a file that couldn't be fo
+und.
Perl looks for the file in all the locations mentioned in @INC, un
+less
the file name included the full path to the file. Perhaps you nee
+d
to set the PERL5LIB or PERL5OPT environment variable to say where
+the
extra library is, or maybe the script needs to add the library nam
+e
to @INC. Or maybe you just misspelled the name of the file. See
"require" in perlfunc and lib.
| [reply] [d/l] |
|
|
|
|
Re: Can't find function in @INC
by tobyink (Canon) on May 04, 2014 at 20:27 UTC
|
$ perl -e'require q/function/'
Can't locate function in @INC (@INC contains: ...) at -e line 1.
use Moops; class Cow :rw { has name => (default => 'Ermintrude') }; say Cow->new->name
| [reply] [d/l] |
|
|
Ah, so the answer should be "the script tried to require a module called 'function' ...". It is a deliberately confusing question, though I suppose it does sort the wheat (you tobyink) from the chaff (me bangor).
| [reply] |
Re: Can't find function in @INC (Can’t locate auto/%s.al in @INC)
by LanX (Saint) on May 04, 2014 at 19:44 UTC
|
You can always search perldiag for unknown error messages (that's what diagnostics does)
The closest I was able to find (searching for '@INC') was
Can’t locate auto/%s.al in @INC
but I have problems to decrypt the description.
(F) A function (or method) was called in a package which al
+lows
autoload, but there is no function to autoload. Most proba
+ble
causes are a misprint in a function/method name or a failur
+e to
"AutoSplit" the file, say, by doing "make install".
I'm ignorant about how to "allow autoload" w/o actually having provided a sub AUTOLOAD somewhere.
Probably either a weird case of inheritance mess up or some kind of XS magic (?).
edit
ah, google is my friend! )
--> What is the /auto/ directory used for? see also AutoSplit
lazy me! (I blame LanX! ;-)
Cheers Rolf
( addicted to the Perl Programming Language)
| [reply] [d/l] [select] |
Re: Can't find function in @INC
by Anonymous Monk on May 04, 2014 at 18:34 UTC
|
I was asked this in a test but have never seen it anywhere before: Neither has the test asker :)
| [reply] |
Re: Can't find function in @INC
by Laurent_R (Canon) on May 04, 2014 at 18:56 UTC
|
If people asking interview tests were asking stupid questions, people would know about it, no?
Oooh, did I goof? Sorry.
| [reply] |
|
|
This was a written test, not an interview - I should have pointed that out.
| [reply] |
|
|
Still, I have seen a number of times written questions that were ambiguous enough to deserve two conflicting or even opposite answers, depending on the level at which you wanted to answer. When you are supposed to give a written answer, you can explain that there are different levels of answers (and hope that the corrector will understand what you mean, I have at least once been in a formal university exam situation where the corrector had no understanding of what I explained to be ambiguous, and I was able to check with the top professor that I was right making a two-sided answer and that the corrector simply did not understand the deepest thoughts that I was expressing, but that's rather uncommon).
And then, there is the multiple-choice type of tests, where you usually have no chance to explain your choice and are at a great difficulty to figure out whether the authority (college or university professor, job interviewer, whatever) is asking for the simple immediate answer, or for a more clever response. I really hate this type of situation. Ambiguity should really be banned from such tests.
| [reply] |
|
|
| A reply falls below the community's threshold of quality. You may see it by logging in. |