… | |
… | |
368 | |
368 | |
369 | =back |
369 | =back |
370 | |
370 | |
371 | =head2 Extension Objects |
371 | =head2 Extension Objects |
372 | |
372 | |
373 | Very perl extension is a perl class. A separate perl object is created |
373 | Every perl extension is a perl class. A separate perl object is created |
374 | for each terminal and each extension and passed as the first parameter to |
374 | for each terminal and each extension and passed as the first parameter to |
375 | hooks. So extensions can use their C<$self> object without having to think |
375 | hooks. So extensions can use their C<$self> object without having to think |
376 | about other extensions, with the exception of methods and members that |
376 | about other extensions, with the exception of methods and members that |
377 | begin with an underscore character C<_>: these are reserved for internal |
377 | begin with an underscore character C<_>: these are reserved for internal |
378 | use. |
378 | use. |
… | |
… | |
907 | |
907 | |
908 | if (my $cb = $TERM->{_hook}[$htype]) { |
908 | if (my $cb = $TERM->{_hook}[$htype]) { |
909 | verbose 10, "$HOOKNAME[$htype] (" . (join ", ", $TERM, @_) . ")" |
909 | verbose 10, "$HOOKNAME[$htype] (" . (join ", ", $TERM, @_) . ")" |
910 | if $verbosity >= 10; |
910 | if $verbosity >= 10; |
911 | |
911 | |
912 | keys %$cb; |
912 | for my $pkg (keys %$cb) { |
913 | |
|
|
914 | while (my ($pkg, $cb) = each %$cb) { |
|
|
915 | my $retval_ = eval { $cb->($TERM->{_pkg}{$pkg}, @_) }; |
913 | my $retval_ = eval { $cb->{$pkg}->($TERM->{_pkg}{$pkg}, @_) }; |
916 | $retval ||= $retval_; |
914 | $retval ||= $retval_; |
917 | |
915 | |
918 | if ($@) { |
916 | if ($@) { |
919 | $TERM->ungrab; # better to lose the grab than the session |
917 | $TERM->ungrab; # better to lose the grab than the session |
920 | warn $@; |
918 | warn $@; |