DOKK / manpages / debian 12 / libstatistics-r-io-perl / Statistics::R::IO::Rserve.3pm.en
Statistics::R::IO::Rserve(3pm) User Contributed Perl Documentation Statistics::R::IO::Rserve(3pm)

Statistics::R::IO::Rserve - Supply object methods for Rserve communication

version 1.0002

    use Statistics::R::IO::Rserve;
    
    my $rserve = Statistics::R::IO::RDS->new('someserver');
    my $var = $rserve->eval('1+1');
    print $var->to_pl;
    $rserve->close;

"Statistics::R::IO::Rserve" provides an object-oriented interface to communicate with the Rserve <http://www.rforge.net/Rserve/> binary R server.

This allows Perl programs to access all facilities of R without the need to have a local install of R or link to an R library.

CONSTRUCTOR

new $server
The single-argument constructor can be invoked with a scalar containing the host name of the Rserve server. The method will immediately open a connection to the server using IO::Socket::INET and perform the initial steps prescribed by the protocol. The method will raise an exception if the connection cannot be established or if the remote host does not appear to run the correct version of Rserve.
new $handle
The single-argument constructor can be invoked with an instance of IO::Handle containing the connection to the Rserve server, which becomes the 'fh' attribute. The caller is responsible for ensuring that the connection is established and ready for submitting client requests.
new ATTRIBUTE_HASH_OR_HASH_REF
The constructor's arguments can also be given as a hash or hash reference, specifying values of the object attributes. The caller passing the handle is responsible for ensuring that the connection is established and ready for submitting client requests.
The no-argument constructor uses the default server name 'localhost' and port 6311 and immediately opens a connection to the server using IO::Socket::INET, performing the initial steps prescribed by the protocol. The method will raise an exception if the connection cannot be established or if the remote host does not appear to run the correct version of Rserve.

ACCESSORS

Name of the Rserve server.
Port of the Rserve server.
A connection handle (stored as a reference to the IO::Handle) to the Rserve server.

METHODS

Evaluates an R expression, given as text string in REXPR, on an Rserve <http://www.rforge.net/Rserve/> server and returns its result as a Statistics::R::REXP object.
Evaluates an R expression, given as text string in REXPR, on an Rserve <http://www.rforge.net/Rserve/> server and returns its result as a Statistics::R::REXP object. This method uses the CMD_serEval Rserve command (code 0xf5), which is designated as "internal/special" and "should not be used by clients". Consequently, it is not recommended to use this method in a production environment, but only to help debug cases where "eval" isn't working as desired.
Transfers a file named REMOTE_NAME from the Rserve server to the local machine, copying it to LOCAL_NAME if it is specified. The file is transferred in binary mode. Returns the contents of the file as a scalar.
Closes the object's filehandle. This method is automatically invoked when the object is destroyed if the connection was opened by the constructor, but not if it was passed in as a pre-opened handle.

Instances of this class are intended to be immutable. Please do not try to change their value or attributes.

There are no known bugs in this module. Please see Statistics::R::IO for bug reporting.

See Statistics::R::IO for support and contact information.

Davor Cubranic <cubranic@stat.ubc.ca>

This software is Copyright (c) 2017 by University of British Columbia.

This is free software, licensed under:

  The GNU General Public License, Version 3, June 2007
2022-02-10 perl v5.34.0