Re: Access .net object from PERL
by marto (Cardinal) on Apr 24, 2006 at 16:57 UTC
|
| [reply] [Watch: Dir/Any] |
Re: Access .net object from PERL
by jimbojones (Friar) on Apr 24, 2006 at 18:41 UTC
|
Hi
Another possibility is that the .NET dlls can be exported as COM objects, and then you could access them as usual. Depends on the 3rd party, I guess.
You could write a .NET wrapper to the 3rd party code that calls the methods you want, and then you can export your wrapper code to COM. I've been doing some of this lately (exporting .NET to COM for 'legacy' apps), so /msg me if it's something you'd want more details on.
HTH, J | [reply] [Watch: Dir/Any] |
|
Hello
As a follow-up to the above, here's how you can wrapper .NET code and expose it to COM, making it available to Perl. The following example wrappers the .NET System.Console.Write and System.Console.WriteLine methods.
| [reply] [Watch: Dir/Any] [d/l] [select] |
|
What does "as usual" mean, in Perl terms?
| [reply] [Watch: Dir/Any] |
|
Hi
Sorry, "as usual" was probably an over-statement. The OP said "It was easy enough to do the old OLE or COM objects," so I assume there is some way to do it with COM objects through Win32::OLE. My experience of late has been to invoke .NET dlls from legacy C apps through COM wrappers. I haven't done this with Perl, but putting it all together (.NET -> COM -> Perl thru OLE ) should work.
- j
| [reply] [Watch: Dir/Any] [d/l] |
Re: Access .net object from PERL
by philcrow (Priest) on Apr 24, 2006 at 18:42 UTC
|
I have a somewhat extreme suggestion. Perhaps you could wrap the third party code with something that exposes it as a SOAP or other web service, then use standard libraries (SOAP::Lite, etc.) to hit it?
Phil | [reply] [Watch: Dir/Any] |
|
Actually that is not all that extreme a suggestion, two approaches are available: either to explicitly create an ASP.NET web services facade for the .NET APIs or to create a small wrapper that exposed them using HTTP Remoting. The former is probably the more flexible and depends less on the way that the API has been designed. The great advantage of using SOAP rather than, say, COM interop is that you are not limited to having the Perl parts of your application run on Windows.
/J\
| [reply] [Watch: Dir/Any] |
Re: Access .net object from PERL
by pKai (Priest) on Apr 24, 2006 at 22:19 UTC
|
ActiveState's PerlNET does give you the feeling to use .NET assemblies in "Perl syntax" | [reply] [Watch: Dir/Any] |
Re: Access .net object from PERL
by jimbojones (Friar) on Apr 24, 2006 at 22:35 UTC
|
Hi
One more thing along the lines of wrappered .NET code and the ActiveState perlNET SDK: .NET supports reflection, so you might be able to write a .NET COM-exposed dll 'reflector' that you access thru OLE. The 'reflector' would take as input your 3rd party dll, and return an object that wrappers your 3rd party code. It's more work, but it's also more general than wrappering every method you want to expose. I suspect that's what perlNET from AS does under the hood (with a lot more syntactical sugar thrown in).
- j | [reply] [Watch: Dir/Any] |