Hi Janandith,

Am Sonntag, den 01.06.2008, 01:26 +0530 schrieb janandith jayawardena:
> Hi Felix ,
> 
> Thanks your explanation helped me a lot.

Good.

>  There is another thing to clarify.
> 
> I created a separate standalone project to test the scala Interpreter.
> According to what I observed the interpreter takes in the script as a string
> to evaluate.

You mean, the Scala interpreter takes a String argument being the script
to execute ? Doesn't the interpreter have a method taking a Reader,
which is the script to execute ?

> Therefore I guess I will have to read the script file and pass it to the
> interpreter in a String.

If there is no reader, yes.

> To do this where should I place my script file for automatic reading. Can I
> use the command.
> 
> "curl -X PUT -d @html.scala
> http://admin:[EMAIL PROTECTED]:8888/apps/foo/bar/html.scala"

The placement of the script is independent of how the script is actually
executed.

> Is it possible for  Object eval(Reader reader , ScriptContext scriptContext)
> to read in the file automatically so I can get the string using "Reader" or
> should I implement an Object eval(String scalaScript , ScriptContext
> scriptContext) method in the script engine.

Sling calls the eval(Reader, ScriptContext) method with the reader
providing access to the script source. If you have to call the Scala
interpreter with a String being the script, you will have to read the
content of the Reader into a String (probaly reading from the Reder into
a StringBuffer until EOF and at the end using StringBuffer.toString() to
get the script) and call the interpreter then.

Hope this helps.

Regards
Felix

Reply via email to