Changes for Versions of the RSPerl Package


  • Another bug when calling an anonymous R function from Perl passed as a reference to Perl. Identified by Hong Ni.
    Reference counting problem on the result from Perl's getName() method for the RReference object.
  • 0.91-1

  • Bug when calling an anonymous R function from Perl passed as a reference to Perl. Identified by Hong Ni.
    RPerl_getReferenceName() left the Perl stack in an unusual state. See for the example.
  • 0.9-1

  • Fix supplied by Michael Dondrup for R_callWithNames in R.xs to avoid a stack imbalance issue in R when dealing with R reference objects from Perl.
  • .PerlInit() now has an additional argument loadModules which can be used to load one or more Perl modules after the Perl interpreter has been initialized.
    You can avoid this by passing a value of FALSE.
  • .PerlPackage now
    • handles a vector of package names as the argument and processes all of them one after another until one fails or they all succeed;
    • returns a simple S3-style object of class PerlPackage which contains the name of the package and a reference to its stash from which one can access the different code objects;
    • avoids checking if the package exists first which was sometimes incorrect,
  • Added mkRef() function to create a Perl reference to a Perl object converted from an R value. This is for use in methods in which strict refs are in force, e.g. the NetAddr::IP::Find module.
    See ipFind.R in tests/ for an example.
  • .PerlGetStash() function added for getting the stash from a reference to a code object, i.e. to get the containing module.
  • perlModuleLoaded can determine whether a module has been loaded in this session.
    (This may not guarantee that it is still loaded!) Unfortunately, it does not seem to provide any updated information after the first time it was called, so it would miss any modules that were loaded subsequent to the first call to perlModuleLoaded.
  • If a reference to a package is made in a call to .Perl, .PerlNew or .PerlStashInfo, it is automatically loaded, if possible.
  • .PerlStashInfo() automatically uses .convert = FALSE for the top-level, main module to avoid cyclic references.
  • Perl's magic types are converted to R as a reference. It is important to preserve the "magic" semantics for general use. Users can provide special converters in the appropriate contexts.
  • .PerlExists() works again.
  • 0.9-0

  • Added facility for specifying where the Perl module files should be installed via the --with-perl-prefix=<dir> and --with-perl-lib=<dir> configuration flags. The values should give the name of the directory which is passed as the value of the PREFIX argument and LIB argument respectively to perl Makefile.PL PREFIX= LIB=. If you want to use the standard Perl location, then use --with-perl-prefix=, i.e. with no value specified for the directory and omit the --with-perl-lib. If you want specify the directory and use that one exactly as the value in PERL5LIB, then use --with-perl-lib.

    The default is still to install the Perl files into
    Note that the R installation process will attempt to perform the installation of the Perl module files. If it does not have permission to write to the relevant directories, it continues. You must then go to the RSPerl/src/ directory in the source package and give the command

            make -f Makefile.perl install
    having obtained the appropriate permissions, e.g., via sudo or logging in as root or whatever.
  • initR() in the Perl module now sets the value of R_HOME if it is not already set in the environment variables of the process and also loads the RSPerl package into R after starting the session.
    initR() is now a regular subroutine and initRSession() is the name of the native routine.
  • Set PERL5LIB in R function .PerlInit() if PERL5LIB and PERLIB are not already set in the process' environment variables.
    Function setPerlLib() is available to set this explicitly if you need it. And getPerl5LibValue() returns the value of the PERL5LIB setting determined at installation time.
  • Non-trivial update to the RFromPerl document (now in HTML from XML).
  • Restored the old (0.8-0 and earlier) behaviour of converting references to Perl arrays and hashes as regular R vectors or lists.
    When conversion is not requested, e.g. with convert = FALSE in an R function call, the class of the resulting Perl reference is computed correctly.
  • When converting a Perl array (or hash) with a mixture of integers and reals (IV and NV in Perl types), the converter recognizes this and creates a numeric vector.
    Added test for this scenario in isHomogeneous.
  • .PerlExpr() now does not terminate via a call to exit when there is an error in the Perl command.
    This changes the third argument to Perl_eval_pv which is croak_on_error. A value of 0 avoids the error. We may use the approach of overriding CORE::exit as in mod_perl also.
  • The opaque data types that are used to represent references to Perl objects as regular R values now use external pointers in R. This will continue to undergoe change to clean this up and remove the R code that treats the object as a list.
  • Removed tryEval.c and all references to tryEval().
  • 0.8-2

  • Modified tryEval.c to be a simple call to R_tryEval(). This avoids the problem of R_ToplevelExec not being an exported symbol unders some compilers.
  • 0.8-1

    names() for a PerlHashReference object now gives back the keys in the underlying Perl hash table.
  • .PerlExpr() takes a convert argument which can be NULL to supress the return value.
  • Use [[ for accessing elements in a PerlHashReference or PerlArrayReference, rather than the [ operator.
    The latter will be modified in subesquent releases to have different semantics.
  • Added convert argument for [[ operator for arrays and hash tables.
  • Caught a general case where the class of the Perl reference was not being computed correctly.
  • 0.8-0

  • The PERL5LIB needed to find the and modules is now simpler: a single element <r package install dir>share/lib/perl5/site_perl/.
    You can still use the shell scripts in scripts/RSPerl.* to set the relevant variables.
  • If --with-in-perl is specified in the configure-args for the R CMD INSTALL command, by default, support for Perl modules with C code are not compiled into the R interface. This is typically not a problem as people usually just call R from Perl. If you need bi-directional interaction, e.g. with callbacks, that require
  • Patch from Stefan Evert for OS X so that we the Perl module can locate the libPerlConverter.dylib file without needing to explicitly set the DYLD_LIBRARY_PATH to find libPerlConverter.*
    You can still use the shell scripts in scripts/RSPerl.* to set the relevant variables.
  • Fixed trivial but significant error in converting homogeneous arrays with references.
    Identified by Jan Hummel. See in the examples/ directory.
  • Added facilities to specify a converter pair (predicate and converter routines) from Perl to convert from Perl to R.
    Previously, this was feasible but not implemented.
  • 0.7-0

  • Added an AUTOLOAD routine for R in Perl.
    This allows users to call R functions using the syntax R::sum(, R::plot(), etc. rather than R::call("sum").
    This does not work for callWithNames(), at this point.
  • 0.6-5

  • Fix to the regular expression in the NAMESPACE file.
  • 0.6-4

    Altered the exportPattern() to explicilty export the functions we want.
    Support for Mac OS X for running R within Perl.
    Location of now points to lib in Makefile.PL.
    .onLoad() initializes the Perl interpreter.
    (Not certain this is a good idea, but it is backward compatible with earlier versions.)
    An undef in Perl was being returned as a reference to a strange object. Fixed now.
    Collapsing Perl arrays into vectors when possible (i.e. homogeneous types) in returning a value from Perl in .Perl() is now working better.
    .PerlFile now checks for the existence of the file and expands the path name, so ~ is expanded.
    Test that the Perl interpreter has been started before evaluating a Perl expression, etc. that uses it. This avoids silly segfaults.
    RPerlDebug in R.xs is now set to off.


    Handle undefined values in callWithNames
    Reported by Michael Dondrup with the example R::callWithNames(foo, {'x'=>undef});


    PDF now not empty files.


  • Patch from Eric Jensen (Information Retrieval Lab at Illinois Institute of Technology) for testing homegeneity of a Perl collection.
  • Fixed R::callWithNames() thanks to a bug report from Eric!
  • Cleanup for R CMD check.
  • NAMESPACE added
    Everything exported.
  • T and F instances changed to TRUE and FALSE.
  • Documentation enhancements and corrections.
  • 0.6-0

    Added a .args argument to .Perl to allow the caller to specify the actual argument list.
    This allows the caller to deal directly with the Perl stack a little more easily.
    Changed the script used in the configuration to use information from the Config module (
    Setting PERL_MODULES to no forces no modules to be loaded.
    This is the same as the command line arguments to the R CMD INSTALL command with the arguments --configure-args='-with-modules=no'.
    Generate our own xs_init if no Perl modules are used (i.e. including R within Perl).
    Switched environment variable to PERL5LIB (from PERLLIB) in scripts.


    --without-modules now works.
    Thanks to Chris Handorf for pointing out the error that caused boot_no to be referenced.


    Test if dTHX is defined and if not provide a pre-processor definition for it.
    Needed for earlier versions of Perl.


    Configuration corrections for including all converter code in the
    Error message about unhandled types in array conversion gives the index of the element.


    Reset the error stack when we cannot find a routine in R_PerlCallModified.


  • Support for compiling with a threaded installation of Perl.
    Manifesting itself as compilation errors about missing variable my_perl. Pointed out by Steffen Neumann.
  • 0.5-1

    Removed the deprecated perl_ prefix from the Perl API routines. Hopefully this will help compilation on systems which currently fail.


    User-level converters
    See setConverter in Perl and addConverter() in R.
    Garbage collection of the RReferences in Perl.
    Check for primitives when converting from R to Perl includes objects with a dimension and/or class attribute.


    Perl calls which do not "use" the return value avoid conversion of the resulting R object.
    This is checks the GIMME_V value to look for a G_VOID context.
    Subsetting a Perl array or hashtable with the [ operator now returns a single value when just one index is used in specifying the subset. This contrasts with returning a list with a single element.
    Handling of NULLs correctly added to different routines.
    Array and hash subsetting works for references also.
    In particular, this works for (blessed) objects of these types.
    Can pass a reference to an R function as the argument to R::call()
    Passing rferences from R to Perl works properly now.
    Report name of the Perl sub-routine being called when an error occurs.
    Added RFunctionReferences and RNamedFunctionReferences to RReferences module. And extended conversion to export R functions using the former. Overloading of the invocation mechanism to allow
          $fun = RNamedFunctionReference->new("foo");
          $f->(arg1, arg2,...);
    Can call R from Perl running within an R session, i.e Perl callbacks to R, for full bi-directional interface.

    Last modified: Mon Sep 11 14:23:34 PDT 2006