On May 7, 2012, at 3:49 PM, Carl pfisterer wrote:

> Thanks Simon, that helps a lot.  With respect to my last question, I have a 
> cgi script that gets user input from a form, then plots the data in R.  What 
> I would like to do is to call run(...) from within the cgi script when the 
> user clicks submit.  
> 

Well, you could get rid of the perl part to start with - FastRWeb automatically 
maps form entries into run() arguments so you should not need perl at all to 
process forms. If you still have some logic in perl that you don't want to push 
to R then your options may be thin -- you could run Rcgi from perl, use AJAX 
(from a page you generate with perl) or connect to Rserve directly, but I don't 
have an Rserve perl client, so you'd have to look elsewhere (maybe 
misappropriating the C++ client or something like that ... however, it should 
be fairly easy to write perl client for this purpose since you're only 
interested in strings)

Cheers,
Simon


> -Carl
> 
> From: Simon Urbanek <[email protected]>
> To: Carl pfisterer <[email protected]> 
> Cc: "[email protected]" <[email protected]> 
> Sent: Monday, May 7, 2012 9:20 AM
> Subject: Re: [R-SIG-Mac] FastRWeb Questions
> 
> Carl,
> 
> On May 7, 2012, at 1:04 PM, Carl pfisterer wrote:
> 
> > I have gotten FastRWeb working on Mac OS X 10.5 but I have a few of 
> > questions.  Is it possible to send more than one argument to run(...)?
> 
> Yes
> 
> 
> >  How would I parse a range sent as an argument (i.e. run(x=1:20))?
> 
> typically
> 
> http://.../R?x1=1&x2=20
> 
> run <- function(x1, x2, ...) {
>   x <- seq(as.integer(x1), as.integer(x2))
>   
> In theory you could use
> 
> http://.../R?x=1:20
> 
> run <- function(x, ...) {
>   x <- eval(parse(text=x))
> 
> but I would not recommend that since it would allow users to inject arbitrary 
> code which is not good for the security ...
> 
> 
> >  Finally, what is the syntax to call the R script from within a PERL script?
> 
> What do you mean? R scripts are to be run from R, not perl... You could 
> simply run the Rcgi binary, but I'm not sure where you are heading with this 
> ...
> 
> 
> >  I have read Simon's paper at: 
> > http://urbanek.info/research/pub/urbanek-iasc08.pdf and it has helped, but 
> > I didn't see these particular items addressed.  FastRWeb looks very 
> > promising, my current implementation initializes R each time and is a bit 
> > slow, I am hopeful this will speed things up a lot. 
> > 
> 
> It certainly will a there is no startup delay.
> 
> Cheers,
> Simon
> 
> 
> 
> 

_______________________________________________
R-SIG-Mac mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-mac

Reply via email to