in reply to Importing functions into packages - globs vs use

They're doing different things.

The first one takes the TRACE glob from the current package and installs a reference to it into the Module::Dependency::Grapher package. This effectively pushes your TRACE subroutine (and other objects) into the Module::Dependency::Grapher package.

The second one imports the TRACE subroutine from Module::Dependency::Grapher into the current package (assuming that Module::Dependency::Grapher is using Exporter).

So they are the complete opposite of each other.

--
<http://dave.org.uk>

"The first rule of Perl club is you do not talk about Perl club."
-- Chip Salzenberg

  • Comment on Re: Importing functions into packages - globs vs use

Replies are listed 'Best First'.
Re^2: Importing functions into packages - globs vs use
by throop (Chaplain) on Nov 30, 2006 at 16:53 UTC
    Ahhh! many thanks. That explains some other strange-seeming behavior that I was not figuring out myself. And sheds light on why &Module::Dependency::Grapher::TRACE was defined, but as a no-op.
      Doing the whole glob (instead of overwriting the CODE slot) prevents a 'redefined' warning, ( I think. Confirmed. )