in reply to Re^3: Noob OO Question
in thread Noob OO Question

$$self->{test_b}->() first dereferences $self. Writing $self->{test_b}->() should work. Or without arrows: &{$$self{test_b}}(). Note the placement of the outer parens.
Also, how do I dereference '$test->method_d()'?
You don't. $test->method_d() returns a string.

Replies are listed 'Best First'.
Re^5: Noob OO Question
by Anonymous Monk on Jun 08, 2010 at 00:12 UTC
    Typing it like this doesn't work for me.
    $self->{test_b}->()
    It gives me this output.
    Not a CODE reference at Hi.pm
      Better yet, change
      my $test = new Hi( test_a => 'hello', test_b => \sub{ return 1 }, test_c => \sub{ get_me( $get_a, $get_b ) }, );
      to
      my $test = new Hi( test_a => 'hello', test_b => sub{ return 1 }, test_c => sub{ get_me( $get_a, $get_b ) }, );

      There's no reason for the extra level of indirect.