Help-Site Computer Manuals
Software
Hardware
Programming
Networking
  Algorithms & Data Structures   Programming Languages   Revision Control
  Protocols
  Cameras   Computers   Displays   Keyboards & Mice   Motherboards   Networking   Printers & Scanners   Storage
  Windows   Linux & Unix   Mac

Hook::Heckle
create pre and post hooks

Hook::Heckle - create pre and post hooks


NAME

Hook::Heckle - create pre and post hooks


SYNOPSIS


  use Hook::Heckle;

        my $notify = sub 

        {                       

                my $this = shift;

                

                printf "Model is informing observers because '%s' change\n", $this->victim and $_[0]->notify_observers( 'update' ) if $_[1]; 

                

                @_;                     

        };

        Hook::Heckle->new( context => 'InputField::String', victim => 'max', pre => sub { $_[0]->{aaa} = 1; }, post => $notify );

        

        Hook::Heckle->new( context => 'InputField::String', victim => 'text', post => $notify );


DESCRIPTION

Creating hooks to subroutines is issued by many other cpan modules. See

But this didnt kept me from writing a new one. It is a base class and can be inherited.

CLASSES

Hook::Heckle

PROPERTIES
Any property has a method and parameter to new counterpart.
victim
The method or subroutine to hook at.

context (default: main)
Package name of the method or subroutine.

pre( $this, @_ )
Reference to sub which will be called before execution of the victim. First argument will be the Hook::Heckel object and second the original arguments of the victim.

post( $this, @_ )
Reference to sub which will be called after execution of the victim. First argument will be the Hook::Heckel object and second the original arguments of the victim.

result
Array of the result from the victim.

METHODS
None.

EXPORT

None by default.


AUTHOR

Murat Uenalan, <muenalan@cpan.org>


SEE ALSO

the Class::Hook manpage, the Hook::Scope manpage, the Hook::WrapSub manpage, the Hook::LexWrap manpage, the Hook::PrePostCall manpage and the Class::Maker manpage.

Programminig
Wy
Wy
yW
Wy
Programming
Wy
Wy
Wy
Wy