Richard Clamp > Hook-Queue > Hook::Queue

Download:
Hook-Queue-1.21.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Module Version: 1.21   Source  

NAME ^

Hook::Queue - define a queue of handlers

SYNOPSIS ^

  # define a Liar class which always claims to be what you're asking
  # about
  package Liar;
  use Hook::Queue 'UNIVERSAL::isa' => sub {
      my $what  = shift;
      my $class = shift;
      return 1 if (ref $what || $what) eq "Liar";
      # it's not my call, pass it down the chain
      return Hook::Queue->defer;
  };

DESCRIPTION ^

Hook::Queue provides a mechanism for stacking global handlers in a queue of routines that will take an attempt at answering the subroutine call addressed to it.

For each subroutine that joins the queue, it can either return a canonical answer, or indicate that it's deferring along the queue by calling the Hook::Queue-defer> method and returning.

When you say use Hook::Queue you join the queue at its current head, and as such your position may very, depending on compilation order of the Perl program. As such you should remember to defer even if your testing shows you to be at the end of the queue in test circumstances.

AUTHOR ^

Richard Clamp <richardc@unixbeard.net>

Copyright Richard Clamp 2004. All Rights Reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

BUGS ^

None known.

Bugs should be reported to me via the CPAN RT system. http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Hook::Queue.

SEE ALSO ^

SUPER, NEXT - for similar idioms for OO programming

syntax highlighting: