Statis...:Rserve(3pm)

πŸ’– Statistics::R::IO::Rserve β€” the perl doc for it, bestie edition πŸ’–

okay so this is the manual page for Statistics::R::IO::Rserve, part of the Statistics::R::IO family of Perl docs. yes the header up there says Statis...:Rserve(3pm) because terminal headers are cowards who truncate. we move.

✨ NAME ✨

Statistics::R::IO::Rserve β€” it hands you object methods for talking to Rserve, fr fr. 🫢

🌸 VERSION 🌸

version 1.0002 β€” that's the one, no cap.

πŸ¦‹ SYNOPSIS πŸ¦‹

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;

look at that. four lines. iconic behavior. πŸ’…

πŸ‘‘ DESCRIPTION πŸ‘‘

Statistics::R::IO::Rserve is giving you an object-oriented interface so your Perl code can chat with the Rserve binary R server (the Rserve website lives at <http://www.rforge.net/Rserve/> β€” that link is literally in the original, i'm not making it up πŸ’€).

and the way this is so useful?? it means your Perl programs get access to all facilities of R without you needing a local install of R, and without linking to an R library. no R on your machine, no linking drama, just vibes and sockets. ✨


πŸŽ€ METHODS πŸŽ€

πŸ’œ CONSTRUCTOR πŸ’œ

  • new $server β€” the single-argument constructor, and you can call it with a scalar holding the host name of the Rserve server. it will immediately open a connection to that server using IO::Socket::INET and do the initial steps prescribed by the protocol. and bestie, listen: it will raise an exception if the connection can't be established, or if the remote host doesn't appear to be running the correct version of Rserve. so, like, no silent failure energy here. 😭
  • new $handle β€” the single-argument constructor can also be invoked with an instance of IO::Handle holding the connection to the Rserve server, and that becomes the 'fh' attribute. heads up tho: the caller is responsible for making sure the connection is established and ready for submitting client requests. that's on you, not on the module. 🫑
  • new ATTRIBUTE_HASH_OR_HASH_REF β€” the constructor's arguments can also come as a hash or a hash reference, specifying values of the object attributes. and same rule as above: the caller passing the handle is responsible for ensuring the connection is established and ready for submitting client requests. πŸ‘‘
  • new β€” the no-argument constructor. it uses the default server name 'localhost' and port 6311, and it immediately opens a connection to the server using IO::Socket::INET, performing the initial steps prescribed by the protocol. and yes, same warning as the first one: it 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 🌈

  • server β€” name of the Rserve server. that's it, that's the whole thing.
  • port β€” port of the Rserve server. slay.
  • fh β€” a connection handle to the Rserve server, stored as a reference to the IO::Handle. πŸŽ€

⭐ METHODS ⭐

  • eval EXPR β€” evaluates an R expression, given as a text string in REXPR, on an Rserve server (yep, <http://www.rforge.net/Rserve/> again) and returns its result as a Statistics::R::REXP object. this is the main character method. πŸ‘‘
  • ser_eval EXPR β€” evaluates an R expression, given as a text string in REXPR, on an Rserve server (<http://www.rforge.net/Rserve/>) and returns its result as a Statistics::R::REXP object. sounds the same as eval?? well, this one uses the CMD_serEval Rserve command (code 0xf5), which is designated as "internal/special" and "should not be used by clients". so, consequently, it is not recommended to use this method in a production environment β€” only to help debug cases where eval isn't working as desired. it's the "for science only" button, bestie. πŸ§ͺ
ngl that quote is from the original, not from me. the module is snitching on its own method.
  • get_file REMOTE_NAME [, LOCAL_NAME] β€” transfers a file named REMOTE_NAME from the Rserve server over to your local machine, copying it to LOCAL_NAME if you specified it. the file is transferred in binary mode. returns the contents of the file as a scalar. πŸ“
  • close β€” closes the object's filehandle. and here's the tea: 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. so if you handed it a handle, you clean up your own mess. πŸ’…

πŸ’€ BUGS AND LIMITATIONS πŸ’€

instances of this class are intended to be immutable. please do not try to change their value or attributes. it said what it said. πŸ™ˆ

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

🫢 SUPPORT 🫢

see Statistics::R::IO for support and contact information. go where the support lives, bestie.

πŸ’œ AUTHOR πŸ’œ

Davor Cubranic <cubranic@stat.ubc.ca> β€” shoutout to the author, legend behavior. πŸ‘‘

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

and that's the whole page, bestie!! this was Statis...:Rserve(3pm) from the User Contributed Perl Documentation, generated by perl v5.34.0, dated 2022-02-10. mwah, go talk to your R server. πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’