#---------------------File Name: simpleR.pl------------------- #! /usr/local/bin/perl -w use Apache::Request () ; use strict ; # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # You only need to modify this: my $Rpath = "C:\\R\\rw\\bin\\" ; # path to rterm.exe # The rest will hopefully run itself. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # to execute R cmd: R($Rpath, $R_cmd) sub R { my $Rpath = shift ; my $Rcmd = $Rpath . "rterm --vanilla --quiet --slave" ; my $Rscript = shift ; $Rscript =~ s/(\r|;\r)/ ;/gm ; $Rscript =~ s/<-/=/gm ; # \r or <- break "echo" return `echo $Rscript | $Rcmd` ; } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - my $r = shift ; # Apache stuff my $q = Apache::Request->new($r) ; # Apache Query obj my $command = $q->param('command') ; my $result = $command ? R($Rpath, $command) : "You didn't input any command." ; # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - print "Content-type: text/html\n\n"; print <<"EOF";
Please enter your R command:


EOF exit;