[nama] Re: analyselv2
- From: "S. Massy" <lists@xxxxxxxxxxxx>
- To: nama@xxxxxxxxxxxxx
- Date: Thu, 24 May 2012 17:26:08 -0400
On Thu, May 24, 2012 at 10:34:55AM -1000, Joel Roth wrote:
> [resending]
>
> On Mon, May 21, 2012 at 07:58:25PM -0400, S. Massy wrote:
> > Hello,
> >
> > Here is analyselv2 with the ability to display scale points info for
> > relevant ports when given the -s option.
>
> Hi Massy,
>
> That's great! I'm thinking about the best way to use your
> code in Nama.
Funny you should mention that. I was playing with moving the subs into a
package today so the code might be reused. So far, here is how I see it.
There would be a sub (analyse_lv2) which would take a URI as its
argument and return references to two 2d hashes, which are the internal
hashes I use. The first one is the plugin info and the second the scale
point info. I also already have a sub which takes a string, perform
case-insensitive search on URIs and returns an array of matches, if any.
> Now, a hash-of-hashes:
>
> %my2d = ( 1 => {a => 'b'}, 4 => {c => 'd'} );
>
> keys %{ $my2d{1} } # a
>
> And a hash-reference of hashes:
>
> $my2d = { 1 => {a => 'b'}, 4 => {c => 'd'} };
>
> keys %{ $my2d->{4} } # c
Ahh, thanks! That's what I was looking for.
> Final advice. Your should plan to write your scripts
> to pass with the "strict" pragma ("use strict" near the top
> of the file.)
A very good piece of advice. I started writing this code full of zeal
and did use strict at first, but I was having such a hard time that I
gave up on it partway through. I should probably go back and attend to
this.
Cheers,
S.M.
Other related posts: