in reply to Re: reference to self function
in thread reference to self function

Unfortunately in the real code, it looks like a call doesn't include $self as an argument. Apologies for not making that need clear earlier. For example, making correlation look like:
sub correlation { my($self, @args) = @_; print "self is $self, there are @args args\n"; }
and creating a new function bar that looks like:
sub bar { my $self = shift; $self->{funcs}{$self->{method}}(); }
When we do:
my $x = new Foo; $x->bar;
the output is errors about uninitialized values, and self is , there are  args

dan

Replies are listed 'Best First'.
Re: Re: Re: reference to self function
by sgifford (Prior) on Jun 25, 2003 at 07:12 UTC
    Ah, then perhaps you want:
    $self->{funcs}{correlation} = sub { $self->correlation(@_) };
    ?
      Ooh, yeah! That works great! Thanks a bunch!

      dan