Inca::IO - Wrapper module for handling IO streams and functions
use Inca::IO; my $stream = new Inca::IO( "incas://localhost:1111", cert => "mycert.pem", key => "mykey.pem", passphrase => $passphrase, trusted => "mytrustedcertdir" ); print $stream "important data"; close( $stream ); # or my $stream = new Inca::IO( "inca://localhost:1111" ); print $stream "important data"; close( $stream ); # or $stream = new Inca::IO( "file:///home/file" ); print $stream "important data"; close( $stream );
This module provides an abstract factory for dealing with different IO streams. It currently handles 3 types:
Format
file://path_to_file
inca://hostname:port
incas://hostname:port
It also provides some IO-related static functions like tempfile.
Class constructor which returns a new Inca::IO object based on the uri.
Arguments:
- uri
A string in the format of <scheme>://<path> where
- scheme
The type of URI being represented by the string (either file or incas)
- path
The location of the URI being represented (e.g., localhost:7070)
- args
A list of follow on arguments for the stream type (e.g., cert, key, passphrase, and trusted certificate directory for the SSL connection).
Create new Inca::IO object which wraps a IO::File object.
Arguments:
- path
A string that contains the path to the file to be written to.
Returns:
A new IO::File object.
Create new Inca::IO object which wraps a IO::Socket::INET object.
Arguments:
- server
The server specification in host:port format
Returns:
A new Inca::IO::INET object.
Create new Inca::IO object which wraps a IO::Socket::SSL.
Arguments:
- host
A string that contains the name of the host to contact.
- port
An integer that contains the port number on the host to contact.
- cert
A string containing the path to the certificate file.
- key
A string containing the path to the key file.
- passphrase
A string containing passphrase to the provided key or undefined if none
- trusted_certs
A string containing the path to the trusted certificate file or directory.
Returns:
An object of type IO::Socket::SSL.
Open a temporary file for writing. If it is not possible to create a temporary file in $dir, /tmp will be tried.
Arguments:
- prefix
A string that contains the prefix of the file name to use.
- dir
An optional string containing the name of the directory to place the temporary file. If undefined, /tmp will be used
Returns:
A filehandle and a string containing the name of the open file.
Shava Smallen <ssmallen@sdsc.edu>