diff --git a/cpanfile b/cpanfile index fe795dc..242be70 100644 --- a/cpanfile +++ b/cpanfile @@ -1,3 +1,4 @@ requires 'Inline::C'; requires 'PDL'; requires 'Scalar::Util::Numeric'; +requires 'Capture::Tiny'; diff --git a/lib/R/Sexp.pm b/lib/R/Sexp.pm index 1d27190..84b3fb7 100644 --- a/lib/R/Sexp.pm +++ b/lib/R/Sexp.pm @@ -5,12 +5,16 @@ use warnings; use Inline with => qw(R::Inline::Rinline R::Inline::Rpdl R::Inline::Rutil); use Inline 'C'; +use Capture::Tiny qw(capture_stdout); -#use overload '""' => \&string; +use overload '""' => \&string; sub string { my ($self) = @_; - return $self->_string; + my $str = capture_stdout { + $self->_string; + }; + return $str; } 1;