http://www.perlmonks.org?node_id=1232982


in reply to Re: Breaking up a big module
in thread Breaking up a big module

I'd say yes ....

... provided all his calls are already ->method calls and all objects/$self are always blessed into Foo and never into Foo::Bar and his not trying to use SUPER ...

In short as long as this approach doesn't lead to multiple inheritance of third party classes.

So probably importing is safer.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

Replies are listed 'Best First'.
Re^3: Breaking up a big module
by Eily (Monsignor) on Apr 25, 2019 at 14:24 UTC

    So probably importing is safer.
    It certainly is the more transparent solution, at least. But the methods that must be moved are used in a limited scope (they are private), so checking for correct calls might not be too cumbersome.

    As always, TIMTOWTDI :)

Re^3: Breaking up a big module
by hdb (Monsignor) on Apr 25, 2019 at 13:36 UTC

    This is probably where all the C++ books explain the difference between "is a" and "uses"...

      since I'm not a C++ programmer you might need to explain further.

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

        The difference is that using methods from some other class (say car) by inheritance means that the class (say racing car) is a kind of that other class (a racing car is a car). While using means that a class (say racing car) is using methods from some other class (say engine) without being of that kind of the other class (a racing car has an engine but is not an engine). This argument is probably not C++ specific but that is where I remember it from.