Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^2: Breaking up a big module

by LanX (Archbishop)
on Apr 25, 2019 at 13:34 UTC ( #1232982=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1232982]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (8)
As of 2019-08-21 09:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?