Re: about dispatch tables

2010-05-06 Thread Harry Putnam
Shlomi Fish writes: > Hi Harry, > > thanks for replying inline (bottom posting). > > On Thursday 06 May 2010 16:19:32 Harry Putnam wrote: >> Shlomi Fish writes: >> >> >> [...] >> >> > sub dispatch >> > { >> > >> >my ($method, @rest_of_args) = @_; >> >> Not sure what $method is supposed

Re: about dispatch tables

2010-05-06 Thread Shlomi Fish
Hi Harry, thanks for replying inline (bottom posting). On Thursday 06 May 2010 16:19:32 Harry Putnam wrote: > Shlomi Fish writes: > > > [...] > > > sub dispatch > > { > > > > my ($method, @rest_of_args) = @_; > > Not sure what $method is supposed to be doing. > Sorry, I'm usually used

Re: about dispatch tables

2010-05-06 Thread Harry Putnam
Shlomi Fish writes: [...] > sub dispatch > { > my ($method, @rest_of_args) = @_; Not sure what $method is supposed to be doing. > my %dispatch = > ( > 'N' => sub { return N_func(@rest_of_args); }, > 'L' => sub { return L_func(@rest_of_args); }, >

Re: about dispatch tables

2010-05-06 Thread Harry Putnam
Harry Putnam writes: Egad... I'm messing up what I want to say way too much. There is an unfortunate type in there... > But after finally reading your comments.. I'm thinking to stick with > something more like this pattern. > > , > | @ar ## already with data inside (global) > | > | sub

Re: about dispatch tables

2010-05-06 Thread Harry Putnam
Akhthar Parvez K writes: > Why are you calling the subroutine N? Have you already defined a > subroutine with the name N in your program? Yes, it was already defined... and I see now how I was nesting a second call in there... not really what was needed or intended. thanks. -- To unsubscri

Re: AW: about dispatch tables

2010-05-06 Thread Harry Putnam
Thomas Bätzler writes: >> sub func { %h = ( N => sub { print N(@_) . "\n"; } ); } > > If you call the sub like this, it'll create the hash %h containing the > key "N" associated with a code reference to an anonymous > subroutine. When that subroutine is called it will pass its _current_ > argumen

Re: about dispatch tables

2010-05-06 Thread Shlomi Fish
On Thursday 06 May 2010 13:24:10 Harry Putnam wrote: > Philip Potter writes: > > On 5 May 2010 17:29, Harry Putnam wrote: > >> Anyway, I understood he was saying NOT global. > >> > >> What I asked is why that would matter. That is, the values or > >> elements in @_ arrive inside the `sub dispt

Re: about dispatch tables

2010-05-06 Thread Harry Putnam
Harry Putnam writes: > . . . . ... I'm still not seeing why the > values in @_ are not available at the call to N() inside like this: > (incomplete code) Disregard above. Sorry about the line noise... I missed the main part of Phillips' explanation -- To unsubscribe, e-mail: beginners

Re: about dispatch tables

2010-05-06 Thread Harry Putnam
Philip Potter writes: > On 5 May 2010 17:29, Harry Putnam wrote: >> Anyway, I understood he was saying NOT global. >> >> What I asked is why that would matter.  That is, the values or >> elements in @_ arrive inside the `sub dispt {...}', so should be >> available to anything inside `sub dispt {

Re: about dispatch tables

2010-05-06 Thread Akhthar Parvez K
On Wednesday 05 May 2010, Harry Putnam wrote: > But even though I can work with that... I'm still not seeing why the > values in @_ are not available at the call to N() inside like this: > (incomplete code) > > func($val1,$val2); > > sub func { %h = ( N => sub { print N(@_#HERE) . "\n"; } ); }