Subject: | bug report for Statistics::R version 0.05 |
Date: | Tue, 14 Sep 2010 16:27:09 -0400 |
To: | bug-Statistics-R [...] rt.cpan.org |
From: | "Delmotte, Florent C" <florent.c.delmotte [...] bankofamerica.com> |
Hello,
I believe there is a bug with the 'error' sub of the current version
(0.05) of Statistics::R.
Consider the following use:
use strict;
use warnings;
use Statistics::R;
my $r = Statistics::R->new();
$r->send('x <- 5');
my $error = $r->error();
When executed, this script dies as follows:
Use of uninitialized value in string ne at
/mass/perl589/lib/site_perl/5.8.9/Statistics/R.pm line 33.
Use of uninitialized value in warn at
/mass/perl589/lib/site_perl/5.8.9/Statistics/R.pm line 35.
Warning: something's wrong at
/mass/perl589/lib/site_perl/5.8.9/Statistics/R.pm line 35.
My suggested fix would be:
sub error {
my $this = shift;
splice( @ERROR, 0, ( $#ERROR - 10 ) ) if @ERROR > 10;
return @ERROR if wantarray;
return $ERROR[ -1 ];
}
Sincerely,
F.D.