Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Undefined entries in %INC?

by Anonymous Monk
on Aug 28, 2012 at 00:44 UTC ( [id://990103]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Can someone explain to me why, sometimes, %INC contains empty values? For example:

( "A.pm" => "/usr/share/perl/5.xx/A.pm", "B.pm" => undef, ... )

The problem is, I can't pinpoint or reproduce this right now. I've encountered this more than a couple of times, first on a laptop, then on a server, causing this code if ($INC{$mod}) { eval { require $mod } } to fail.

Does undef value on an entry in %INC have any useful meaning? Or is it a bug with some code, somewhere that sets %INC? I'm pretty sure none of my code modifies %INC in anyway. Have someone experienced this too?

Replies are listed 'Best First'.
Re: Undefined entries in %INC?
by ig (Vicar) on Aug 28, 2012 at 06:08 UTC
    Does undef value on an entry in %INC have any useful meaning?

    See require. An undef value for an entry in %INC may record the fact that an attempt to include a file failed, at least in some cases. But if it was set by means other than require, it may indicate something else. The only aspect of the value that is well defined is that it should be true if the file was included successfully and false otherwise. undef is just one of the false values.

Re: Undefined entries in %INC?
by Anonymous Monk on Aug 28, 2012 at 02:24 UTC

    Does undef value on an entry in %INC have any useful meaning?

    Nope. It only means someone carelessly put stuff into %INC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://990103]
Approved by toolic
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (2)
As of 2024-04-24 22:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found