NAME

Sprocket::Util::FDpasser - Pass File Descripters using File::FDpasser

SYNOPSIS

my $passer = Sprocket::Util::FDpasser->new(
    EndpointFile => '/tmp/fdpasser',
    Connect => 0
);

$passer->attach_hook( 'sprocket.fdpasser.accept', sub {
    my $event = shift;
    warn "received filehandle: $event->{fh}";
} );

# send a file handle
$passer->send_fd( *STDIN{IO} );

DESCRIPTION

This module provides a session that watches File::FDpasser's filehandle for readability, and emits an event for received file handles.

This module is a subclass of Sprocket::Util::Observable and inherits all of its methods.

METHODS

new

Create a new FD passer object

EndpointFile => (str)

A path to an FDpasser endpoint.

Connect => (true|false)

Connect to (true) or create (false) the endpoint

send_fd( $filehandle )

HOOKS

sprocket.fdpasser.accept

Emitted on $self and $sprocket, in that order. $event->{fh} is the filehandle received.

SEE ALSO

Sprocket, Sprocket::Util::Observable, File::FDpasser

AUTHOR

David Davis <xantus@cpan.org>

COPYRIGHT AND LICENSE

Copyright 2006-2007 by David Davis

See Sprocket for license information.