exilepanda has asked for the wisdom of the Perl Monks concerning the following question:

Hello monks,

Sorry I believe I have given a pretty poor title but I really can't think of any better one, and I think this is the fact though. I'd like to know if there's any chance I can have such code candies ?

my $obj = bless { Root => $rootDir, UserDir => $obj->{Root} . "Usr/$userId/", UserAppData = $obj->{UserDir} . "$appName/", }, shift; # of cause this won't work
instead of :
$obj = bless { Root => $rootDir, UserDir => undef, UserAppData => undef, }, shift; $obj->{UserDir} = $obj->{Root} . "Usr/$userId"; $obj->{UserAppData} = $obj->{UserDir} . "$appName";
In fact I have much more paths that I need to defined while the object is created, but I hope to state the logic of the properties in clear at the first place.

I guess I am out of luck but still trying to ask because when the interpreter read {Root}, that should be some place already stored the value ( but I juz don't know how to ref to it), no?


I know why it's not working, what I try to emphasize is only inside the hash, so please forgive I didn't manage to give good code about the before and after.

Though, I suddenly recalled something ( thank you very much for all you guys' feedback ). Yrs ago, I wrote a module for interpret an INI config file. Which accepts things like this:

[ConfigDirs] A = /some/dir B = /_#A#_/DeeperDir C = /_#B#_/EvenDeeperDir
And my module will go through it line by line. Every key recorded can be used by the next line. Regex will replace the _#*#_ with a proper recorded key's value. So it Data::Dump will produce something like
$var = { 'ConfigDirs' => { 'A'=> '/some/dir', 'B'=> '/some/dir/DeeperDir', 'C'=> '/some/dir/DeeperDir/EvenDeeperDir' } }
Now the questions can be added are: 1) is there any existing module deal's something like that? 2) is there any threat I elaborating things in this way?

As I am going to reuse this module's code to let me accept params as I originally proposed.