CSmatthieu has asked for the wisdom of the Perl Monks concerning the following question:
Hi all,
I need you'r help for a specific issue.
My problem :
I need to access to an attribute path into an object. Here a typical example :
my $objectWhenceFindPath; $objectWhenceFindPath->{here}->{an}->{hypothetical}->{path} = "some va +lue"; my @path = ("an", "hypothetical", "path"); my $currentPath = $objectWhenceFindPath->{here}; for my $index (0 .. ($#path - 1)) { $currentPath = $currentPath->{$path[$index]}; # Some logic, or not. Depend of script. } $currentPath ++;
At this time, I have not find any solutions to do this. Note as functional, the $objectWhenceFindPath is retrieved from an object subroutine.
Tested solution :
Many thanks to anyone able to purpose a solution.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Object attribute follower
by Corion (Patriarch) on Apr 14, 2016 at 19:52 UTC | |
by CSmatthieu (Initiate) on Apr 14, 2016 at 20:06 UTC | |
|
Re: Object attribute follower
by kcott (Archbishop) on Apr 15, 2016 at 04:41 UTC |