From estrabd at mailcan.com Tue Nov 4 09:17:14 2008 From: estrabd at mailcan.com (B. Estrade) Date: Tue, 4 Nov 2008 11:17:14 -0600 Subject: [Neworleans-pm] Tie::Hash::Indexed question Message-ID: <20081104171714.GA35138@bc3.hpc.lsu.edu> I can't seem to find it via Dr. Google, and before I go to IRC or PM, I wanted to ask here. If I use Tie::Hash::Indexed to define an ordered hash, should this apply to all hashes in a nested data structure? The following example does not propagate this to nested hashes: #!/bin/env perl use strict; use Tie::Hash::Index; tie my %test, 'Tie::Hash::Indexed'; %test = ( 1 => { a => 100, b => 200, c => 300, }, 2 => { d => 400, e => 500, f => 600, }, 3 => { g => 700, h => 800, i => 900, }, ); foreach my $key (keys(%test)) { print "$key\n"; foreach my $ikey (keys(%{$test{$key}})) { print " $ikey\n"; } } 1; __END__ The output looks like: 1 c a b 2 e d f 3 h g i But I want: 1 a b c 2 d e f 3 h i j And this indicates that the nested hashs are not 'tie'd. Does anyone one know if there is something I can do when 'tie'ing the root hash so that this property is passed down? If not, how would I 'tie' and anonymous hash? And before anyone tells me that I should be using an array, note that I am writing up a test for something that doesn't required ordered keys to be expressed. I am trying to work within existing code to generate a "worst-case" hash order, and for that I need to make sure that certain keys are accessed in-order. Cheers, Brett -- B. Estrade Louisiana Optical Network Initiative +1.225.578.1920 aim: bz743 :wq From estrabd at mailcan.com Tue Nov 4 09:20:11 2008 From: estrabd at mailcan.com (B. Estrade) Date: Tue, 4 Nov 2008 11:20:11 -0600 Subject: [Neworleans-pm] Tie::Hash::Indexed question In-Reply-To: <20081104171714.GA35138@bc3.hpc.lsu.edu> References: <20081104171714.GA35138@bc3.hpc.lsu.edu> Message-ID: <20081104172011.GB35138@bc3.hpc.lsu.edu> Okay, now I feel silly - I think I found the answer at PerlMonks :)... http://www.perlmonks.org/?displaytype=print;node_id=485306;replies=1 Cheers, Brett On Tue, Nov 04, 2008 at 11:17:14AM -0600, B. Estrade wrote: > I can't seem to find it via Dr. Google, and before I go to IRC or PM, I wanted to ask here. > > If I use Tie::Hash::Indexed to define an ordered hash, should this apply to all hashes in a nested data structure? The following example does not propagate this to nested hashes: > > #!/bin/env perl > use strict; > use Tie::Hash::Index; > > tie my %test, 'Tie::Hash::Indexed'; > %test = ( 1 => { a => 100, > b => 200, > c => 300, }, > 2 => { d => 400, > e => 500, > f => 600, }, > 3 => { g => 700, > h => 800, > i => 900, }, > ); > > foreach my $key (keys(%test)) { > print "$key\n"; > foreach my $ikey (keys(%{$test{$key}})) { > print " $ikey\n"; > } > } > > 1; > __END__ > > The output looks like: > > 1 > c > a > b > 2 > e > d > f > 3 > h > g > i > > But I want: > > 1 > a > b > c > 2 > d > e > f > 3 > h > i > j > > And this indicates that the nested hashs are not 'tie'd. Does anyone one know if there is something I can do when 'tie'ing the root hash so that this property is passed down? If not, how would I 'tie' and anonymous hash? > > And before anyone tells me that I should be using an array, note that I am writing up a test for something that doesn't required ordered keys to be expressed. I am trying to work within existing code to generate a "worst-case" hash order, and for that I need to make sure that certain keys are accessed in-order. > > Cheers, > Brett > > > > > -- > B. Estrade > Louisiana Optical Network Initiative > +1.225.578.1920 aim: bz743 > :wq > _______________________________________________ > NewOrleans-pm mailing list > NewOrleans-pm at pm.org > http://mail.pm.org/mailman/listinfo/neworleans-pm -- B. Estrade Louisiana Optical Network Initiative +1.225.578.1920 aim: bz743 :wq From estrabd at mailcan.com Tue Nov 4 09:29:42 2008 From: estrabd at mailcan.com (B. Estrade) Date: Tue, 4 Nov 2008 11:29:42 -0600 Subject: [Neworleans-pm] Tie::Hash::Indexed question - SOLVED In-Reply-To: <20081104172011.GB35138@bc3.hpc.lsu.edu> References: <20081104171714.GA35138@bc3.hpc.lsu.edu> <20081104172011.GB35138@bc3.hpc.lsu.edu> Message-ID: <20081104172942.GC35138@bc3.hpc.lsu.edu> And the winning solution: #!/bin/env perl use strict; use Tie::Hash::Indexed; sub tieH { tie my %hash, 'Tie::Hash::Indexed', @_; return \%hash; } tie my %test, 'Tie::Hash::Indexed'; %test = ( 1 => tieH( a => 100, b => 200, c => 300), 2 => tieH( d => 400, e => 500, f => 600), 3 => tieH( g => 700, h => 800, i => 900), ); foreach my $key (keys(%test)) { print "$key\n"; foreach my $ikey (keys(%{$test{$key}})) { print " $ikey\n"; } } 1; On Tue, Nov 04, 2008 at 11:20:11AM -0600, B. Estrade wrote: > Okay, now I feel silly - I think I found the answer at PerlMonks :)... > > http://www.perlmonks.org/?displaytype=print;node_id=485306;replies=1 > > Cheers, > Brett > > On Tue, Nov 04, 2008 at 11:17:14AM -0600, B. Estrade wrote: > > I can't seem to find it via Dr. Google, and before I go to IRC or PM, I wanted to ask here. > > > > If I use Tie::Hash::Indexed to define an ordered hash, should this apply to all hashes in a nested data structure? The following example does not propagate this to nested hashes: > > > > #!/bin/env perl > > use strict; > > use Tie::Hash::Index; > > > > tie my %test, 'Tie::Hash::Indexed'; > > %test = ( 1 => { a => 100, > > b => 200, > > c => 300, }, > > 2 => { d => 400, > > e => 500, > > f => 600, }, > > 3 => { g => 700, > > h => 800, > > i => 900, }, > > ); > > > > foreach my $key (keys(%test)) { > > print "$key\n"; > > foreach my $ikey (keys(%{$test{$key}})) { > > print " $ikey\n"; > > } > > } > > > > 1; > > __END__ > > > > The output looks like: > > > > 1 > > c > > a > > b > > 2 > > e > > d > > f > > 3 > > h > > g > > i > > > > But I want: > > > > 1 > > a > > b > > c > > 2 > > d > > e > > f > > 3 > > h > > i > > j > > > > And this indicates that the nested hashs are not 'tie'd. Does anyone one know if there is something I can do when 'tie'ing the root hash so that this property is passed down? If not, how would I 'tie' and anonymous hash? > > > > And before anyone tells me that I should be using an array, note that I am writing up a test for something that doesn't required ordered keys to be expressed. I am trying to work within existing code to generate a "worst-case" hash order, and for that I need to make sure that certain keys are accessed in-order. > > > > Cheers, > > Brett > > > > > > > > > > -- > > B. Estrade > > Louisiana Optical Network Initiative > > +1.225.578.1920 aim: bz743 > > :wq > > _______________________________________________ > > NewOrleans-pm mailing list > > NewOrleans-pm at pm.org > > http://mail.pm.org/mailman/listinfo/neworleans-pm > > -- > B. Estrade > Louisiana Optical Network Initiative > +1.225.578.1920 aim: bz743 > :wq > _______________________________________________ > NewOrleans-pm mailing list > NewOrleans-pm at pm.org > http://mail.pm.org/mailman/listinfo/neworleans-pm -- B. Estrade Louisiana Optical Network Initiative +1.225.578.1920 aim: bz743 :wq From djohn at archdiocese-no.org Tue Nov 4 09:50:58 2008 From: djohn at archdiocese-no.org (David B. John) Date: Tue, 04 Nov 2008 11:50:58 -0600 Subject: [Neworleans-pm] Tie::Hash::Indexed question In-Reply-To: <20081104172011.GB35138@bc3.hpc.lsu.edu> References: <20081104171714.GA35138@bc3.hpc.lsu.edu> <20081104172011.GB35138@bc3.hpc.lsu.edu> Message-ID: <1225821058.8664.17.camel@isd4> On Tue, 2008-11-04 at 11:20 -0600, B. Estrade wrote: > Okay, now I feel silly - I think I found the answer at PerlMonks :)... > > http://www.perlmonks.org/?displaytype=print;node_id=485306;replies=1 > > Cheers, > Brett > Good find. Would a sort keys work as well? Dave -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part URL: From estrabd at mailcan.com Tue Nov 4 12:33:38 2008 From: estrabd at mailcan.com (B. Estrade) Date: Tue, 4 Nov 2008 14:33:38 -0600 Subject: [Neworleans-pm] Tie::Hash::Indexed question In-Reply-To: <1225821058.8664.17.camel@isd4> References: <20081104171714.GA35138@bc3.hpc.lsu.edu> <20081104172011.GB35138@bc3.hpc.lsu.edu> <1225821058.8664.17.camel@isd4> Message-ID: <20081104203338.GJ35138@bc3.hpc.lsu.edu> On Tue, Nov 04, 2008 at 11:50:58AM -0600, David B. John wrote: > On Tue, 2008-11-04 at 11:20 -0600, B. Estrade wrote: > > > Okay, now I feel silly - I think I found the answer at PerlMonks :)... > > > > http://www.perlmonks.org/?displaytype=print;node_id=485306;replies=1 > > > > Cheers, > > Brett > > > > Good find. Would a sort keys work as well? Well, I wanted insert order, and for my needs this didn't necessarily correspond with a numerical sorting of the hash keys like my example did. It's a good thought, and one I considered. Cheers, Brett > > Dave -- B. Estrade Louisiana Optical Network Initiative +1.225.578.1920 aim: bz743 :wq From jkeen at verizon.net Tue Nov 11 20:19:30 2008 From: jkeen at verizon.net (Jim Keenan) Date: Tue, 11 Nov 2008 22:19:30 -0600 (CST) Subject: [Neworleans-pm] Out-of-town Visitor Message-ID: <14056760.710301226463570125.JavaMail.root@vms074.mailsrvcs.net> An HTML attachment was scrubbed... URL: From donnie at solomonstreet.com Tue Nov 11 21:29:56 2008 From: donnie at solomonstreet.com (Donnie Cameron) Date: Wed, 12 Nov 2008 00:29:56 -0500 Subject: [Neworleans-pm] Out-of-town Visitor In-Reply-To: <14056760.710301226463570125.JavaMail.root@vms074.mailsrvcs.net> References: <14056760.710301226463570125.JavaMail.root@vms074.mailsrvcs.net> Message-ID: <24e3b4050811112129p681e5fabv8ed0ea6f9e54bb31@mail.gmail.com> I will definitely make it to a meetup on Thursday (6pm - 7pm) but not Saturday. Mona's on Frenchmen is good, but any other location in New Orleans will also work for me. --Donnie Cameron http://donnieknows.com/contact On Tue, Nov 11, 2008 at 11:19 PM, Jim Keenan wrote: > > > > > Date: Thu, 16 Oct 2008 21:44:46 -0400 > > From: James E Keenan > > Subject: [Neworleans-pm] Out-of-town Visitor > > To: neworleans-pm at pm.org > > > I'll be in NOLA Wed Nov 12 - Sat Nov 15 for my approximately biannual > > musical pub crawl. If there are any Perlmongers who would like > > together, please let me know. > > > > I am in town now, a day ahead of schedule. Brett tried to arrange something > in Baton Rouge, but that didn't work out. But if anyone wants to get > together for a brief meetup, I'm still up for it. > > Probably early Thursday evening (6:00-7:00) or Saturday late morning/early > afternoon would work best for me. The last time I was here (March 2006), we > met at Mona's (504 Frenchmen St) at 11:00 on a Saturday morning. That worked > for me because I was staying in the Marigny, as I am now. > > So if anyone is interested, post to list and to jkeen at verizon dot net. > > Thank you very much. > Jim Keen an > _______________________________________________ > NewOrleans-pm mailing list > NewOrleans-pm at pm.org > http://mail.pm.org/mailman/listinfo/neworleans-pm > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkeen at verizon.net Wed Nov 12 04:49:55 2008 From: jkeen at verizon.net (Jim Keenan) Date: Wed, 12 Nov 2008 06:49:55 -0600 (CST) Subject: [Neworleans-pm] Out-of-town Visitor Message-ID: <2082867189.1505561226494195987.JavaMail.root@vms170009.mailsrvcs.net> An HTML attachment was scrubbed... URL: From jamesekeenan at yahoo.com Wed Nov 12 15:51:38 2008 From: jamesekeenan at yahoo.com (James Keenan) Date: Wed, 12 Nov 2008 15:51:38 -0800 (PST) Subject: [Neworleans-pm] Meetup Thursday 6:00 pm at Mona's on Frenchmen St Message-ID: <222453.92830.qm@web53808.mail.re2.yahoo.com> I'm not sure how well my previous post appeared on the list, because I don't have access to my regular SMTP provider. So I just took out a new subscription from a web address. Hope to see some of you Thursday at 6:00 at Mona's at 504 Frenchmen St. Jim Keenan From donnie at solomonstreet.com Wed Nov 12 15:53:44 2008 From: donnie at solomonstreet.com (Donnie Cameron) Date: Wed, 12 Nov 2008 18:53:44 -0500 Subject: [Neworleans-pm] Meetup Thursday 6:00 pm at Mona's on Frenchmen St In-Reply-To: <222453.92830.qm@web53808.mail.re2.yahoo.com> References: <222453.92830.qm@web53808.mail.re2.yahoo.com> Message-ID: <24e3b4050811121553i17d215b3wfce5e72dc5a980df@mail.gmail.com> i'll be there --donnie http://donnieknows.com/contact On Wed, Nov 12, 2008 at 6:51 PM, James Keenan wrote: > I'm not sure how well my previous post appeared on the list, because I > don't have access to my regular SMTP provider. So I just took out a new > subscription from a web address. > > Hope to see some of you Thursday at 6:00 at Mona's at 504 Frenchmen St. > > Jim Keenan > > > > _______________________________________________ > NewOrleans-pm mailing list > NewOrleans-pm at pm.org > http://mail.pm.org/mailman/listinfo/neworleans-pm > -------------- next part -------------- An HTML attachment was scrubbed... URL: