in reply to Re^3: Code reference problem
in thread Code reference problem

The ampersand is not needed. And

if ( defined( my $coderef = $self -> { CALLBACK }{ ALL } ) ) { $coderef -> ( $tref );

avoids deref clutter.

--shmem

_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}

Replies are listed 'Best First'.
Re^5: Code reference problem
by Moron (Curate) on Jan 04, 2007 at 16:34 UTC
    At last!

    Following your suggestions I first had to refactorise it into this to avoid compilation error from redefining $coderef:

    my $coderef = $self -> { CALLBACK }{ ALL } || $self -> + { CALLBACK }{ TAG }{ $tag }; defined( $coderef ) and $coderef -> ( $tref );
    But as soon as I ran that the program worked as supposed to immediately. Thanks very much!

    -M

    Free your mind