As others have already said, %INC.

However, note that it's quite possible to directly manipulate this hash:

use 5.010; # Trick perl into thinking that Moose.pm has # already been required. $INC{'Moose.pm'} = '/tmp/Moose.pm'; # Require it for real. But perl does nothing! require Moose; # Perl thinks Moose is loaded. say "Moose is loaded" if $INC{'Moose.pm'}; # But it isn't really, so we don't know VERSION. say 'Moose version:', Moose->VERSION;

I have in the past had cause to directly manipulate %INC. A module I was using wanted to be passed the name of plugin module to use. It would require that plugin and then use it. However, I wanted to define the plugin inline in my code, a la

{ package My::Plugin; ... } Something::That::Uses::Plugins->load_plugin('My::Plugin');

But this caused Something::That::Uses::Plugins to attempt to require the non-existent file "My/Plugin.pm". So...

{ package My::Plugin; ... $INC{'My/Plugin.pm'} = __FILE__; } Something::That::Uses::Plugins->load_plugin('My::Plugin');

And everybody's happy.

But anyway, my point is that although %INC should give you the information you want, it can't necessarily be trusted 100%.


In reply to Re: Can I see "requires"? by tobyink
in thread Can I see "requires"? by DreamT

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.