Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
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.

In reply to reference to an undefined key by exilepanda

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others cooling their heels in the Monastery: (7)
    As of 2020-04-04 09:40 GMT
    Find Nodes?
      Voting Booth?
      The most amusing oxymoron is:

      Results (32 votes). Check out past polls.