in reply to Re: Which "use" statements in a module do "bubble up" to the callers? [SOLVED]
in thread Which "use" statements in a module do "bubble up" to the callers? [SOLVED]

use is require followed by import, no more and no less. import is defined by the module in question, and can do whatever it wants. Normally, it adds stuff to the caller's symbol table, but it doesn't have to.
  • Comment on Re^2: Which "use" statements in a module do "bubble up" to the callers? [SOLVED]

Replies are listed 'Best First'.
Re^3: Which "use" statements in a module do "bubble up" to the callers? [SOLVED]
by haukex (Archbishop) on Sep 01, 2017 at 14:50 UTC
    use is require followed by import, no more and no less.

    I agree that the parent could be worded better, but if we're being nitpicky, that's also not quite right. use Module VERSION LIST (where both VERSION and LIST are optional) is equivalent to:

    BEGIN {
      require Module;
      Module->VERSION( VERSION );  # if VERSION was specified
      Module->import( LIST );      # *except* when LIST is "()"
    }
    

    And use VERSION; requires a minimum version of Perl. That's all use does, and whether the Module is a prgama, regular module, or whatever else, is up to that module and its import, not use. Update: Well now I need to nitpick myself - use VERSION; also enables the feature bundle for that version and strict if the version is 5.12 or greater. Also, it should be noted that if Module doesn't have a sub import, no error is raised.

      pee-ay yeh-zoo doh-mee-nay *thunk* doh-nah eh-ees re-kwee-em *thunk*