(This question is composed of sub-questions)

I've noticed that there are some functions that don't require use-ing or require-ing to use: for instance, the Time::HiRes:: functions, the utf8:: utility functions, Cwd::getcwd(), etc.

1st question (sort of offtopic): where do I find a reference/list of these functions which require no require or use to use?

I had thought at first that maybe all core modules could be called via long name without require, but then I realized that that's not the case (e.g. Data::Dumper::Dumper(), File::Copy::, etc.)...so that's one of the reasons why I'm curious about which (module) functions can be called with require or use.

But that got me thinking also about (2nd question) whether or not it makes a performance difference when using "long" package names (regardless of whether require is required) vs. use-ing (require-ing and importing) and calling the subroutine from my namespace directly. I mean does perl have to convert long names into paths or something to locate the function everytime (just a wild guess, because it might make a difference in that case)? In some of my perl scripts I actually load modules that use XS via XSLoader::load() directly (and XSLoader doesn't require a require, a surprise to me) directly, and then I have to call the functions I want to use via long names each time.

These things might seem trivial to most, but I'm just really curious and would probably do things a little differently if I knew what was going on. Sometimes I try to avoid conveniences if it leads to benefits in other areas.


In reply to Is there any (performance) benefit to importing functions? by YenForYang

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.