in reply to Re: refrencing a hash
in thread refrencing a hash

hey thanks a lot for replying, yeah I didn't copy and paste i was gonna type it all out but then I changed my mind, well what I really wanna do is use the Class::Singleton module since I'm struggling with it for last 2 days and haven't gotten anywhere :( and there's a lot of code I would have to make changes to ....the ERRMSG has around 2000 errors :( I'll appreciate any help...

Replies are listed 'Best First'.
Re^3: refrencing a hash
by give_me_donations (Initiate) on Feb 17, 2005 at 01:36 UTC
    I did what you expalined but still this is what I see on perl-status Data Dump of foo::bar::package::ERRMSG SCALAR $foo::bar::package::ERRMSG = { 'CUSTLINK_CREATESESSION_506' => 'We did not recognize your member name or password. Please re-enter your member name and password. (Error 506)', 'CUSTLINK_GETVALUE_506' => 'We did not recognize your member name or password. Please re-enter your member name and password. (Error 506)', 'CUSTLINK_LOOKUP_506' => 'We did not recognize your member name or password. Please re-enter your member name and password. (Error 506)' }; whereas I wanna show this ($foo::bar::package::ERRMSG = ) saying (package::config::ERRMSG) thanks in advnace
      $package::config::ERRMSG is just a name. You can access the value associated with that name by simply saying $package::config::ERRMSG from anywhere in any package. But you can't assign a name to another name; that just doesn't make sense.

      The value associated with that name is a reference to a nameless (anonymous) hash stored in memory. Likewise, $foo::bar::package::ERRMSG contains a reference pointing to the exact same hash in memory. To prove it, simply print the value of $ERRMSG in your config package and every package that uses it. You'll see something like:

      HASH(0x1010e180)

      The number is the memory address where the hash is stored, and each copy in each of your packages will have the same number there.

      By the way, please check out the <code> tag for formatting your code so we can read it easily.

      Also see perlref and perldsc.

      What problems are you having with Class::Singleton? Show some code and we'll probably be able to point to what's wrong. Remember to use the <code> ... </code> tags. :)