Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^6: Creating flexible method accessor

by puterboy (Scribe)
on Feb 02, 2014 at 04:08 UTC ( #1073028=note: print w/ replies, xml ) Need Help??


in reply to Re^5: Creating flexible method accessor
in thread Creating flexible method accessor

The problem with 'walking the path' is that there is no guarantee that the path will be: ->{hash1}->{hash2}->{hash3}
It could be any combination of hashes, hashrefs, arrays, arrayrefs -- which is why I wanted to pass a *string* rather than a list (array) of hash keys.


Comment on Re^6: Creating flexible method accessor
Re^7: Creating flexible method accessor
by Anonymous Monk on Feb 02, 2014 at 04:20 UTC

    Then you might want to start looking into CPAN modules, for example a really quick search brings up Data::Path.

    Otherwise, although I would really try to avoid string eval as much as possible, when it is used it's best to limit its scope as much as possible: $self = eval qq{ \$self->$path }; die $@ if $@;

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2014-12-26 03:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (164 votes), past polls