Sprog::Mixin::OutputToFH.3pm

Langue: en

Version: 2005-07-26 (fedora - 01/12/10)

Section: 3 (Bibliothèques de fonctions)

NAME

Sprog::Mixin::OutputToFH - a 'mixin' class for gears writing output to a file handle

SYNOPSIS

   use base qw(
     Sprog::Mixin::OutputToFH
     Sprog::Gear
   );
 
   sub engage {
     my($self) = @_;
 
     my $fh = $self->_open_output_file or return;
     $self->fh_out($fh);
 
     return $self->SUPER::engage;
   }
 
 

DESCRIPTION

This mixin is for use by gears which need to write to a file handle (ie: files, pipes, sockets ...). It provides the appropriate links into the event loop to write using non-blocking IO.

METHODS

fh_out ( filehandle )

The gear class is responsible for opening the file handle and then passing it to this method to make it available to the other methods in this class.

data ( data )

When the gear receives a "data" message, this method will be invoked and the data will be queued to be written to the filehandle. Copyright 2005 Grant McLean <grantm@cpan.org>

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