title: Calling .NET from Perl
body: <p>I have a Perl script and needed to call a method that's in a .NET assembly.  I found <a href="http://www.perlmonks.org/?node_id=392275" rel="nofollow noreferrer">this technique</a> but it's quite involved for a one-off Perl script so I didn't use it.  I ended up writing a trivial .NET console app as a wrapper for the call I need and have my Perl script communicate with the wrapper, using <code>Console.In / Console.Out / IPC::Open2</code>.</p>
  
  <p>This turned out to be problematic because .NET's <code>StreamReader.ReadToEnd</code> method did not seem able to detect the end-of-file on <code>Console.In</code>, even after my Perl script closed its end of the pipe!</p>
  
  <p>I ended up hacking a solution that worked for my purposes, but is there a better way to call .NET from Perl?</p>