# we currently don't bother to support anything but outputing the
# entire segment of code and its R output
- if (not exists $param{code} or not defined $param{code}) {
+ if (not exists $param{code}
+ or not defined $param{code}
+ or not length $param{code}) {
error("There wasn't any R code supplied");
}
my $code_result;
$code_result = $pagestate{$param{page}}{$id}{R}->run($param{code});
};
if ($@) {
- error($@);
+ error("code '$param{code}' produced error '$@'");
}
my $output = "sweave output\n\n";
if (exists $param{verbatim}) {
$output = $param{code};
$output =~ s/^/> /mg;
}
- $output .= $code_result;
+ $output .= "\n".$code_result;
$output =~ s/^/ /mg;
return($output);
}