Statis...coding(3pm)
π NAME π
Statistics::R::IO::QapEncoding β functions for parsing Rserve packets, bestie. (And yes, this is that Statis...coding(3pm) page you saw in the header β the title got truncated, it's giving mystery, but it's this one, iykyk.)
β¨ VERSION β¨
version 1.0002 β iconic, we love a version number π
πΈ SYNOPSIS πΈ
use Statistics::R::IO::QapEncoding qw( decode );
# Assume $data comes from an Rserve response body
my ($rexp, $state) = @{ decode($data) }
or die "couldn't parse";
# If we're reading a QAP response, there should be no data left
# unparsed
die 'Unread data remaining' unless $state->eof;
# the result of the unserialization is a REXP
say $rexp;
# REXPs can be converted to the closest native Perl data type
print $rexp->to_pl;
π¦ DESCRIPTION π¦
Okay so, this module is the one doing the actual reading of serialized R objects encoded with Rserve's QAP protocol, and then converting them into a Statistics::R::REXP. Lowkey the backbone energy.
But heads up, bestie: you are not expected to use it directly. It's normally wrapped by evalRserve in Statistics::R::IO and eval in Statistics::R::IO::Rserve. So it's like, backstage crew, not the main character β but the show does not happen without it. π
π SUBROUTINES π
decode $dataβ constructs aStatistics::R::REXPobject from its serialization in$data. Hands you back a pair: the object itself, and theStatistics::R::IO::ParserStatesitting at the end of serialization.decode_sexp,decode_intβ parsers for Rserve'sDT_SEXPandDT_INTdata types, respectively.dt_sexp_dataβ parses the body of an RserveDT_SEXPobject by parsing its header (theXT_type and length) and its content (which is done by sequencingunpack_sexp_infoandsexp_data).unpack_sexp_infoβ parser for the header (made of theXT_*type, flags, and object length) of a serialized SEXP. Returns a hash with keysobject_type,has_attributes, andlength, each one corresponding to the field in R serialization described in the QAP1 protocol description athttp://www.rforge.net/Rserve/dev.html.sexp_data $obj_infoβ parser for a QAP-serialized R object, using the object type stored in$obj_infohash'sobject_typekey to pick the correct parser for that particular type.intsxp,langsxp,lglsxp,listsxp,rawsxp,dblsxp,cplxsxp,strsxp,symsxp,vecsxp,expsxp,closxp,s4sxpβ parsers for the corresponding R SEXP-types. Yes, that's thirteen of them, they really said "we contain multitudes". πnosxpβ parser for Rserve'sXT_UNKNOWNtype, which encodes an R SEXP-type that does not have a corresponding representation in QAP.maybe_attributes $object_infoβ convenience parser for SEXP attributes, which are serialized as a tagged pairlistXT_LIST_TAGfollowed by a SEXP for the object value. Attributes are stored only if$object_infoindicates their presence. Returns a pair of$object_infoand a hash reference to the attributes, as returned bytagged_pairlist_to_attribute_hash.tagged_pairlistβ parses a pairlist (optionally tagged) and returns an array where each element is a hash containing keysvalue(the REXP of the pairlist element) and, optionally,tag.tagged_pairlist_to_rexp_hashβ converts a pairlist to a REXP hash whose keys are the pairlist's element tags and whose values are the pairlist elements themselves.tagged_pairlist_to_attribute_hashβ converts object attributes, which are serialized as a pairlist with the attribute name in the element's tag, to a hash that can be used as theattributesargument to Statistics::R::REXP constructors.
Some attributes are serialized using a compact encoding (for instance, when a table's row names are just integers 1:nrows), and this function will decode them to a complete REXP. Cute, efficient, slay. β¨
π BUGS AND LIMITATIONS π
There are no known bugs in this module. Please see Statistics::R::IO for bug reporting.
Not me reporting zero bugs, that's a clean sheet fr fr. π«Ά
π«Ά SUPPORT π«Ά
See Statistics::R::IO for support and contact information.
π AUTHOR π
Davor Cubranic <cubranic@stat.ubc.ca> β the icon, the legend, the moment. π
π COPYRIGHT AND LICENSE π
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 β born from perl v5.34.0, dated 2022-02-10, and filed under User Contributed Perl Documentation. Go forth and parse those packets. π
π¦πΈ
π¦ where this page comes from
- debian bookworm: libstatistics-r-io-perl 1.0002-2 Β· GPL-3.0-only
- debian trixie: libstatistics-r-io-perl 1.0002-2 Β· GPL-3.0-only
- ubuntu jammy: libstatistics-r-io-perl 1.0002-2 Β· GPL-3.0-only
- ubuntu noble: libstatistics-r-io-perl 1.0002-2 Β· GPL-3.0-only
- ubuntu resolute: libstatistics-r-io-perl 1.0002-2 Β· GPL-3.0-only
- ubuntu stonking: libstatistics-r-io-perl 1.0002-2 Β· GPL-3.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms