File::FDkeeper

File::FDkeeper can store open filehandles in another process for later use.
Download

File::FDkeeper Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Patrick LeBoutillier
  • Publisher web site:
  • http://search.cpan.org/~patl/File-FDkeeper-0.06/FDkeeper.pod

File::FDkeeper Tags


File::FDkeeper Description

File::FDkeeper can store open filehandles in another process for later use. File::FDkeeper can store open filehandles in another process for later use.SYNOPSIS # "server" my $fdk = new File::FDkeeper(Local => "/tmp/fdkeeper.sock") ; $fdk->run() ; # "client" my $fdk = new File::FDkeeper(Peer => "/tmp/fdkeeper.sock") ; my $id = $fdk->put($some_fh) ; $fh = $fdk->get($id) ; $fdk->del($id) ;File::FDkeeper allows you to store open filehandles in a "server" process and retrieve them at a later time from another process.When a filehandle is stored, an id is returned. This id can then be used by any other process to retrieve the filehandle (as long as they have permission to open the fifo).CONSTRUCTORSnew ( )Creates an File::FDkeeper object. new expects the following argument groups, in key-value pairs: Local Path to local fifo AccessTimeout Filehandles not accessed since this number of seconds will be closed. Default is 0 (infinity). AccessTimeoutCheck Frequency (in seconds) to check for expired filehandles. Default is 0 (never). Peer Path to peer fifoIf Local is specified, a "server" object is created.If Peer is specified, a "client" object is created.METHODSput ( FILEHANDLE )Stores FILEHANDLE and returns the associated id. An exception is thrown if an error occurs.Note: when put is called from a "client" object, FILEHANDLE will be closed once it has been sent to the "server". This seems to be necesasry in order to be able to get and use that handle later in that process.get ( ID )Retrieves filehandle ID and returns it. Returns undef if filehandle ID is not presentily stored. An exception is thrown if an error occurs.del ( ID )Removes and closes filehandle ID. Returns undef if filehandle ID is not presently stored. An exception is thrown if an error occurs.cnt ( )Returns the number of filehandles currently in the "server". An exception is thrown if an error occurs.run ( )Note: This method is available only on the "server" objects.Starts listening for connections on the fifo in order to store filehandles. Normally, this method does not return. However, if LIFELINE is a valid filehandle, run will return when any data (or EOF) is received on LIFELINE. If used, LIFELINE is normally a pipe used as such: use IO::Pipe ; my $pipe = new IO::Pipe() ; if (fork()){ $pipe->reader() ; require File::FDkeeper ; my $fdk = new File::FDkeeper(Local => "/tmp/fdkeeper.sock") ; $fdk->run($pipe) ; exit() ; } $pipe->writer() ; # do stuff... # When this process dies, the File::FDkeeper server process will # die as well. Requirements: · Perl


File::FDkeeper Related Software