Embedding Perl Interpreter

Posted by cam on Stack Overflow See other posts from Stack Overflow or by cam
Published on 2010-01-13T11:39:27Z Indexed on 2010/05/12 16:14 UTC
Read the original article Hit count: 388

Filed under:
|
|

Hi, just downloaded ActivePerl. I want to embed the perl interpreter in a C# application (or at least call the perl interpreter from C#). I need to be able to send send out data to Perl from C#, then receive the output back into C#.

I just installed ActivePerl, and added MS Script Control 1.0 as a reference. I found this code on the internet, but am having trouble getting it to work.

 MSScriptControl.ScriptControlClass Interpreter = new MSScriptControl.ScriptControlClass();
Interpreter.Language = @"ActivePerl";
string Program = @"reverse 'abcde'";
string Results = (string)Interpreter.Eval(Program);
return Results;

Originally, it had 'PerlScript' instead of 'ActivePerl', but neither work for me. I'm not entirely sure what Interpreter.Language expects. Does it require the path to the interpreter?

Solved... I'm not sure how, but when I changed it back to PerlScript it works now. Still, I would like to know if MSScript Control is using ActivePerl or another interpreter.

© Stack Overflow or respective owner

Related posts about perl

Related posts about embed