Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^2: Dynamically generate setter/getter methods [Updated]

by Arunbear (Prior)
on Dec 20, 2020 at 16:36 UTC ( #11125501=note: print w/replies, xml ) Need Help??


in reply to Re: Dynamically generate setter/getter methods [Updated]
in thread Dynamically generate setter/getter methods

The AUTOLOAD approach has some caveats to be aware of:

1. It will be marginally slower because each call to the accessor will search the inheritance tree before calling AUTOLOAD

2. Querying the object with can will return a false result, which is probably not what users of the object would expect.

  • Comment on Re^2: Dynamically generate setter/getter methods [Updated]

Replies are listed 'Best First'.
Re^3: Dynamically generate setter/getter methods [Updated]
by stevieb (Canon) on Dec 20, 2020 at 19:28 UTC

    Thanks Arunbear. I thought about this a bit more, and I almost feel I dabbled with AUTOLOAD quite some years ago, but found deficiencies that prevented me from using it. That said, I very well could be off my rocker and thinking about something else. I will give it a try though and see how it goes.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (2)
As of 2021-10-16 09:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (69 votes). Check out past polls.

    Notices?