Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^3: Inherit parent, AND also import parent's exported sub ??

by Anonymous Monk
on Sep 08, 2016 at 20:39 UTC ( [id://1171433]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Inherit parent, AND also import parent's exported sub ??
in thread Inherit parent, AND also import parent's exported sub ??

Read Exporter

use base 'One'; use One '/.+/';

OO classes that export lots of stuff ... code smell :)

Replies are listed 'Best First'.
Re^4: Inherit parent, AND also import parent's exported sub ??
by exilepanda (Friar) on Sep 09, 2016 at 11:23 UTC
    Seem to work but when I subclass Two, that function just gone again... Seem I should end this in my first subclass by:
    sub nameOfOldFunc { shift; return OldClass::nameOfOldFunc ( @_ ) ; }
    making it a method, and this become a method ever after.

    Thank you very much for the help!

      Any chance you could share some of your real code that demonstrates what you're attempting to do? What you've suggested here is not scalable, and a bit confusing.

      Perhaps if we understood the real problem you're facing with real example code, we could provide better solutions to your dilemma.

      Having both inherited and imported subs coming from the same module is a bit unusual, unless you're intentionally directing your API to both OO and functional crowds, or providing backwards-compatibility (there are other scenarios, but I digress).

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2025-11-12 12:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (68 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.