windows - Calling .NET from Perl -
I have a Perl script and need to call a method that is in a .NET assembly. I found it, but it is very much involved for a Perl script so I did not use it. I've finished writing a trivial .NET console app as a cover for the call and using my Pearl script by Console.In / Console.Out / IPC :: Open2
. Need to communicate with / P>
This became problematic because the .NET's StreamReader.ReadToEnd
method was not able to detect the end of the file on Console.In
, my Even after the pipe closes at the end of the Pearl script!
I have terminated the solution for my purposes, but is there a better way to call .NET than Pearl?
"StreamReader.ReadToEnd method is able to detect end-of-file on console "
You think that is capable of interfacing with .net. But you have called on console input it can be problematic, even a part of why it is without pearl:
ReadToEnd assumes that the stream knows that it The end is reached for interactive protocols, in which the server demands the data, when you ask for it and do not close the connection, ReadToEnd can block indefinitely and it should be avoided.
Maybe your code is correct, but you need to use a different method for your purpose.
Edit:
"I did a trivial .NET console app as a cover"
It seems that you try to communicate between two (Pearl and .NET). The protocols you choose (console.In / Out) can work, but in your code, for streaming, you can easily find out when the stream is off, the read operation will return null
When they are in EOF
Alternatively, you can use any method that pleases you in Perl and it is called from .NET. I.e., you reverse the argument and the .NET only asks for interface with its Pearl code interface. Then you can stick with Pearl for your main programming work. You can do this.
Comments
Post a Comment