| Class-Delay documentation | view source | Contained in the Class-Delay distribution. |
Class::Delay - delay method dispatch until a trigerring event
package PrintOut;
sub write {
my $self = shift;
print "printing: ", @_, "\n";
}
sub flush {
print "flushed\n";
}
package DelayedPrint;
use base 'PrintOut';
use Class::Delay
methods => [ 'write' ],
release => [ 'flush' ];
package main;
DelayedPrint->write( "we'll write this later" ); # won't get through
# to PrintOuts 'write' yet
DelayedPrint->write( "this too" );
DelayedPrint->flush; # all of the queued call are dispatched
DelayedPrint->write( "this won't be delayed" );
This module has external dependencies on the following modules:
Class::Accessor::Fast Test::More perl 5.006
perl Build.PL perl Build test
and if all goes well
perl Build install
What changed over the last 3 revisions
Fixed a test failure - now the triggering method will also return the nominated value also.
Initial CPAN release =back
Richard Clamp <richardc@unixbeard.net>
Copyright (C) 2003 Richard Clamp. All Rights Reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| Class-Delay documentation | view source | Contained in the Class-Delay distribution. |