Skip to content

Commit

Permalink
use Capture::Tiny to get string representation of SEXP
Browse files Browse the repository at this point in the history
Hacky solution to #8 <#8>.
This will need to be revisited later.
  • Loading branch information
zmughal committed Nov 25, 2014
1 parent a292660 commit 31a0b05
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions cpanfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
requires 'Inline::C';
requires 'PDL';
requires 'Scalar::Util::Numeric';
requires 'Capture::Tiny';
8 changes: 6 additions & 2 deletions lib/R/Sexp.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 31a0b05

Please # to comment.