Re: Self referencing hash

2008-08-12 Thread Dermot
> Dermot wrote: >> 2008/8/11 Rob Dixon <[EMAIL PROTECTED]>: >> >>> - The usual reason for using a variable name with a leading underscore is to >>> denote that it's a private variable, but lexical variables aren't visible >>> outside the package anyway so you may as well drop the underscore and mak

Re: Self referencing hash

2008-08-12 Thread Jenda Krynicky
From: "Mr. Shawn H. Corey" <[EMAIL PROTECTED]> > Yes, you have to do it after-the-fact, so to speak. > > #!/usr/bin/perl > > use strict; > use warnings; > use utf8; > > use Data::Dumper; > $Data::Dumper::Sortkeys = 1; > $Data::Dumper::Indent = 1; > $Data::Dumper::Maxdepth = 0; > > my %_HASH;

Re: Self referencing hash

2008-08-12 Thread Rob Dixon
Dermot wrote: > 2008/8/11 Rob Dixon <[EMAIL PROTECTED]>: > >> - The usual reason for using a variable name with a leading underscore is to >> denote that it's a private variable, but lexical variables aren't visible >> outside the package anyway so you may as well drop the underscore and make it >

Re: Self referencing hash

2008-08-12 Thread Mr. Shawn H. Corey
On Tue, 2008-08-12 at 03:00 +0100, Dermot wrote: > I was struggling with this before I left work. In a line like > print "Starting with ", $self->[0]->{type},"\n"; > > I got > > Starting with HASH(x0023408) > > Not what as I was hoping for. Perhaps I was calling it correctly. > You are calling

Re: Self referencing hash

2008-08-11 Thread Dermot
2008/8/11 Rob Dixon <[EMAIL PROTECTED]>: > Dermot wrote: >> >> Phew. >> >> I thought I was loosing my marbles there. I was staring at the screen >> for ages trying to find a difference. To be fair, I think the >> semi-colon were my balls-up :-/ >> >> Yes Rob I am trying to do some OO. It might make

Re: Self referencing hash

2008-08-11 Thread Mr. Shawn H. Corey
On Mon, 2008-08-11 at 20:28 +0100, Rob Dixon wrote: > - To answer your question, yes it's a good idea to write accessor methods like > type so that they will both read and write a value. But I would guess that you > shouldn't be able to modify an object's type once it has been created? There is mu

Re: Self referencing hash

2008-08-11 Thread Rob Dixon
Dermot wrote: > > Phew. > > I thought I was loosing my marbles there. I was staring at the screen > for ages trying to find a difference. To be fair, I think the > semi-colon were my balls-up :-/ > > Yes Rob I am trying to do some OO. It might make sense for what I'm > after (upload different ty

Re: Self referencing hash

2008-08-11 Thread Dermot
2008/8/11 yitzle <[EMAIL PROTECTED]>: > On Mon, Aug 11, 2008 at 11:40 AM, Rob Dixon <[EMAIL PROTECTED]> wrote: >> yitzle wrote: >>> On Mon, Aug 11, 2008 at 9:52 AM, Dermot <[EMAIL PROTECTED]> wrote: I am trying to make hash that refers to itself like this my %_HASH; %_HASH

Re: Self referencing hash

2008-08-11 Thread yitzle
On Mon, Aug 11, 2008 at 11:40 AM, Rob Dixon <[EMAIL PROTECTED]> wrote: > yitzle wrote: >> On Mon, Aug 11, 2008 at 9:52 AM, Dermot <[EMAIL PROTECTED]> wrote: >>> >>> I am trying to make hash that refers to itself like this >>> >>> my %_HASH; >>> %_HASH = ( >>> typeOne => { >>> root => '/pa

Re: Self referencing hash

2008-08-11 Thread Rob Dixon
yitzle wrote: > On Mon, Aug 11, 2008 at 9:52 AM, Dermot <[EMAIL PROTECTED]> wrote: >> >> I am trying to make hash that refers to itself like this >> >> my %_HASH; >> %_HASH = ( >> typeOne => { >> root => '/path/to/typeOne', >> logfile => $_HASH{typeOne}->{root}.'/logone.log'; >>

Re: Self referencing hash

2008-08-11 Thread yitzle
Not the way you are doing it. This would work, though: my %_HASH; %_HASH = ( typeOne => { root => '/path/to/typeOne', logfile => $_HASH{typeOne}->{root}.'/logone.log'; }, typeTwo => { root => '/path/to/typeTwo', logfile => $_HASH{typeTwo}->{root}.'/logtwo.l

Re: Self referencing hash

2008-08-11 Thread Mr. Shawn H. Corey
On Mon, 2008-08-11 at 14:52 +0100, Dermot wrote: > Hi, > > I am trying to make hash that refers to itself like this > > my %_HASH; > %_HASH = ( >typeOne => { > root => '/path/to/typeOne', > logfile => $_HASH{typeOne}->{root}.'/logone.log'; > }, >typeTwo => { >