Re: How to simulate VB Casting for $perl_objects via Win32::OLE?
Date sent: Thu, 17 Dec 2009 12:36:27 -0600 Subject:Re: How to simulate VB Casting for $perl_objects via Win32::OLE? From: w...@serensoft.com w...@serensoft.com To: Jenda Krynicky je...@krynicky.cz Copies to: perl-win32-users@listserv.activestate.com That looks like a utility to take an existing perl program and convert it to a .NET-savvy executable: http://docs.activestate.com/pdk/8.1/ = click PerlNET link If that's the case, it won't resolve our issue. If it's not the case, we misunderstood. :) The thing is that Win32::OLE is for accessing OLE/COM DLLs and processes, not .Net ones. PerlNET will let you use .Net classes from your Perl code. The fact that it will then have to build an executable is a bit inconvenient, but that's not the point. Jenda = je...@krynicky.cz === http://Jenda.Krynicky.cz = When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: How to simulate VB Casting for $perl_objects via Win32::OLE?
Subject:How to simulate VB Casting for $perl_objects via Win32::OLE? Short version: how can we simulate .NET/VB object-type CASTing, in Win32::OLE Perl? Long version: We're building a bridge between a java-web-app and a .net-based-desktop app. Perl is the glue language of choice, of course :) Where we've got trouble is that the .net programmers tell us we need to cast object_1 to be type object_2, and we haven't see how that's done in the Win32::OLE manual pages. I believe you need PerlNET (http://www.activestate.com/perl_dev_kit/features/) not Win32::OLE. Jenda = je...@krynicky.cz === http://Jenda.Krynicky.cz = When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: How to simulate VB Casting for $perl_objects via Win32::OLE?
That looks like a utility to take an existing perl program and convert it to a .NET-savvy executable: http://docs.activestate.com/pdk/8.1/ = click PerlNET link If that's the case, it won't resolve our issue. If it's not the case, we misunderstood. :) On Thu, Dec 17, 2009 at 10:58 AM, Jenda Krynicky je...@krynicky.cz wrote: Subject:How to simulate VB Casting for $perl_objects via Win32::OLE? Short version: how can we simulate .NET/VB object-type CASTing, in Win32::OLE Perl? Long version: We're building a bridge between a java-web-app and a .net-based-desktop app. Perl is the glue language of choice, of course :) Where we've got trouble is that the .net programmers tell us we need to cast object_1 to be type object_2, and we haven't see how that's done in the Win32::OLE manual pages. I believe you need PerlNET (http://www.activestate.com/perl_dev_kit/features/) not Win32::OLE. Jenda = je...@krynicky.cz === http://Jenda.Krynicky.cz = When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs -- will trillich Tis the set of the sails / And not the gales / That tells the way we go. -- Ella Wheeler Wilcox ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: PerlScript OLE browser [was How to simulate VB Casting for $perl_objects via Win32::OLE?]
Woo hoo, yes indeed! That did the trick. Thanks, Jan! BTW -- Jan, I don't recall the last time I posted a newbie-ish question and got as much information-packed help as what you've been providing here. Kudos! Thanks a bunch, keep up the good work... On Wed, Dec 16, 2009 at 6:42 PM, Jan Dubois j...@activestate.com wrote: Ok, here is what Graham from ActiveState support tells me: You *may* also need to go to the “Security” tab in the “Internet Options”, select “Local intranet” and click on the “Sites” button. Then disable the “Automatically detect intranet network” and instead select the individual choices underneath manually. I wonder if we shouldn’t drop the OLE browser from ActivePerl; it is hard to get it working, and enabling it leaves you with a security vulnerability unless you can trust all web pages on your local intranet. Note that both Microsoft Visual Studio and Microsoft Office come with Object browsers themselves, so if you have either of them, it might be easier to use those browsers instead (the Win32::OLE browser is basically a re-implementation of the one from Office 97 in Perl and DHTML). Cheers, -Jan *From:* trill...@gmail.com [mailto:trill...@gmail.com] *On Behalf Of * w...@serensoft.com *Sent:* Wednesday, December 16, 2009 3:11 PM *To:* Jan Dubois *Cc:* perl-win32-users@listserv.activestate.com *Subject:* PerlScript OLE browser [was How to simulate VB Casting for $perl_objects via Win32::OLE?] Thanks Jan. We've got the .NET wonks working on just this approach. BTW... what does it take to get the PerlScript OLE browser to work? I tried a quick test (below) and PerlScript is working in IE, but the OLE browser frames are all empty except for the default could not load gripe at the bottom. Is there a start-condition of some sort? (And Initialize and script ActiveX controls not marked as safe is set to Enable for the local intranet zone...) script language=PerlScript $window-{status} = 'Hi from PerlScript!'; # works! /script http://www.xav.com/perl/site/lib/Win32/OLE/Browser/Browser.html file:///C:/Perl/html/lib/Win32/OLE/Browser.html On Wed, Dec 16, 2009 at 2:10 PM, Jan Dubois j...@activestate.com wrote: Win32::OLE uses late binding (the IDispatch interface, aka OLE Automation); there is no such thing as casting to different “objects” as there is only a single IDispatch interface per object. This is the same as using Jscript or VBScript, but not VB or C++ which normally use early binding. It is up to the developer of the object to make sure all interfaces are automation accessible. Ask them for sample code in VBScript or VBA. If you cannot access the interfaces from there, then you won’t be able to access them via Win32::OLE either. Cheers, -Jan *From:* perl-win32-users-boun...@listserv.activestate.com [mailto: perl-win32-users-boun...@listserv.activestate.com] *On Behalf Of * w...@serensoft.com *Sent:* Wednesday, December 16, 2009 11:40 AM *To:* perl-win32-users@listserv.ActiveState.com *Subject:* How to simulate VB Casting for $perl_objects via Win32::OLE? Hi -- Short version: how can we simulate .NET/VB object-type CASTing, in Win32::OLE Perl? Long version: We're building a bridge between a java-web-app and a .net-based-desktop app. Perl is the glue language of choice, of course :) Where we've got trouble is that the .net programmers tell us we need to cast object_1 to be type object_2, and we haven't see how that's done in the Win32::OLE manual pages. For example we start with a Collection, iterate through CoursesCollection-Item(ix) and from there we get a StudentsCollection-Item( foo ) which is a generic object but needs to be CAST as a 'proper' Student object instead. How do we do that in Win32::OLE? my $classes = App-Classes; my $class_ct = $classes-Count; for ( my $class_ix = 1; $class_ix = $class_ct; $class_ix ++ ) { my $class = $classes-Item( $class_ix ); my $students = $class-Students; my $stu_ct = $students-Count; for ( my $stu_ix = 1; $stu_ix = $stu_ct; $stu_ix ++ ) { my $stu = $students-Item( $stu_ix ); # $stu is a GENERIC object here with only basic methods # need to 'cast' it to Student type so we can get grades my $grades = $stu-Grades; # boom! (Name not found, meaning no such method) } } We were hoping the objects were classed somehow inside Perl, but all objects appear to be simply Win32::OLE objects, and even trying to get to the hash keys gives an error... Any pointers/flames welcome. Thanks! -- will trillich Tis the set of the sails / And not the gales / That tells the way we go. -- Ella Wheeler Wilcox -- will trillich Tis the set of the sails / And not the gales / That tells the way we go. -- Ella Wheeler Wilcox -- will trillich Tis the set of the sails / And not the gales / That tells the way we go. -- Ella Wheeler Wilcox
How to simulate VB Casting for $perl_objects via Win32::OLE?
Hi -- Short version: how can we simulate .NET/VB object-type CASTing, in Win32::OLE Perl? Long version: We're building a bridge between a java-web-app and a .net-based-desktop app. Perl is the glue language of choice, of course :) Where we've got trouble is that the .net programmers tell us we need to cast object_1 to be type object_2, and we haven't see how that's done in the Win32::OLE manual pages. For example we start with a Collection, iterate through CoursesCollection-Item(ix) and from there we get a StudentsCollection-Item( foo ) which is a generic object but needs to be CAST as a 'proper' Student object instead. How do we do that in Win32::OLE? my $classes = App-Classes; my $class_ct = $classes-Count; for ( my $class_ix = 1; $class_ix = $class_ct; $class_ix ++ ) { my $class = $classes-Item( $class_ix ); my $students = $class-Students; my $stu_ct = $students-Count; for ( my $stu_ix = 1; $stu_ix = $stu_ct; $stu_ix ++ ) { my $stu = $students-Item( $stu_ix ); # $stu is a GENERIC object here with only basic methods # need to 'cast' it to Student type so we can get grades my $grades = $stu-Grades; # boom! (Name not found, meaning no such method) } } We were hoping the objects were classed somehow inside Perl, but all objects appear to be simply Win32::OLE objects, and even trying to get to the hash keys gives an error... Any pointers/flames welcome. Thanks! -- will trillich Tis the set of the sails / And not the gales / That tells the way we go. -- Ella Wheeler Wilcox ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: How to simulate VB Casting for $perl_objects via Win32::OLE?
Win32::OLE uses late binding (the IDispatch interface, aka OLE Automation); there is no such thing as casting to different objects as there is only a single IDispatch interface per object. This is the same as using Jscript or VBScript, but not VB or C++ which normally use early binding. It is up to the developer of the object to make sure all interfaces are automation accessible. Ask them for sample code in VBScript or VBA. If you cannot access the interfaces from there, then you won't be able to access them via Win32::OLE either. Cheers, -Jan From: perl-win32-users-boun...@listserv.activestate.com [mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of w...@serensoft.com Sent: Wednesday, December 16, 2009 11:40 AM To: perl-win32-users@listserv.ActiveState.com Subject: How to simulate VB Casting for $perl_objects via Win32::OLE? Hi -- Short version: how can we simulate .NET/VB object-type CASTing, in Win32::OLE Perl? Long version: We're building a bridge between a java-web-app and a .net-based-desktop app. Perl is the glue language of choice, of course :) Where we've got trouble is that the .net programmers tell us we need to cast object_1 to be type object_2, and we haven't see how that's done in the Win32::OLE manual pages. For example we start with a Collection, iterate through CoursesCollection-Item(ix) and from there we get a StudentsCollection-Item( foo ) which is a generic object but needs to be CAST as a 'proper' Student object instead. How do we do that in Win32::OLE? my $classes = App-Classes; my $class_ct = $classes-Count; for ( my $class_ix = 1; $class_ix = $class_ct; $class_ix ++ ) { my $class = $classes-Item( $class_ix ); my $students = $class-Students; my $stu_ct = $students-Count; for ( my $stu_ix = 1; $stu_ix = $stu_ct; $stu_ix ++ ) { my $stu = $students-Item( $stu_ix ); # $stu is a GENERIC object here with only basic methods # need to 'cast' it to Student type so we can get grades my $grades = $stu-Grades; # boom! (Name not found, meaning no such method) } } We were hoping the objects were classed somehow inside Perl, but all objects appear to be simply Win32::OLE objects, and even trying to get to the hash keys gives an error... Any pointers/flames welcome. Thanks! -- will trillich Tis the set of the sails / And not the gales / That tells the way we go. -- Ella Wheeler Wilcox ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
PerlScript OLE browser [was How to simulate VB Casting for $perl_objects via Win32::OLE?]
Thanks Jan. We've got the .NET wonks working on just this approach. BTW... what does it take to get the PerlScript OLE browser to work? I tried a quick test (below) and PerlScript is working in IE, but the OLE browser frames are all empty except for the default could not load gripe at the bottom. Is there a start-condition of some sort? (And Initialize and script ActiveX controls not marked as safe is set to Enable for the local intranet zone...) script language=PerlScript $window-{status} = 'Hi from PerlScript!'; # works! /script http://www.xav.com/perl/site/lib/Win32/OLE/Browser/Browser.html file:///C:/Perl/html/lib/Win32/OLE/Browser.html On Wed, Dec 16, 2009 at 2:10 PM, Jan Dubois j...@activestate.com wrote: Win32::OLE uses late binding (the IDispatch interface, aka OLE Automation); there is no such thing as casting to different “objects” as there is only a single IDispatch interface per object. This is the same as using Jscript or VBScript, but not VB or C++ which normally use early binding. It is up to the developer of the object to make sure all interfaces are automation accessible. Ask them for sample code in VBScript or VBA. If you cannot access the interfaces from there, then you won’t be able to access them via Win32::OLE either. Cheers, -Jan *From:* perl-win32-users-boun...@listserv.activestate.com [mailto: perl-win32-users-boun...@listserv.activestate.com] *On Behalf Of * w...@serensoft.com *Sent:* Wednesday, December 16, 2009 11:40 AM *To:* perl-win32-users@listserv.ActiveState.com *Subject:* How to simulate VB Casting for $perl_objects via Win32::OLE? Hi -- Short version: how can we simulate .NET/VB object-type CASTing, in Win32::OLE Perl? Long version: We're building a bridge between a java-web-app and a .net-based-desktop app. Perl is the glue language of choice, of course :) Where we've got trouble is that the .net programmers tell us we need to cast object_1 to be type object_2, and we haven't see how that's done in the Win32::OLE manual pages. For example we start with a Collection, iterate through CoursesCollection-Item(ix) and from there we get a StudentsCollection-Item( foo ) which is a generic object but needs to be CAST as a 'proper' Student object instead. How do we do that in Win32::OLE? my $classes = App-Classes; my $class_ct = $classes-Count; for ( my $class_ix = 1; $class_ix = $class_ct; $class_ix ++ ) { my $class = $classes-Item( $class_ix ); my $students = $class-Students; my $stu_ct = $students-Count; for ( my $stu_ix = 1; $stu_ix = $stu_ct; $stu_ix ++ ) { my $stu = $students-Item( $stu_ix ); # $stu is a GENERIC object here with only basic methods # need to 'cast' it to Student type so we can get grades my $grades = $stu-Grades; # boom! (Name not found, meaning no such method) } } We were hoping the objects were classed somehow inside Perl, but all objects appear to be simply Win32::OLE objects, and even trying to get to the hash keys gives an error... Any pointers/flames welcome. Thanks! -- will trillich Tis the set of the sails / And not the gales / That tells the way we go. -- Ella Wheeler Wilcox -- will trillich Tis the set of the sails / And not the gales / That tells the way we go. -- Ella Wheeler Wilcox ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: PerlScript OLE browser [was How to simulate VB Casting for $perl_objects via Win32::OLE?]
Ok, here is what Graham from ActiveState support tells me: You may also need to go to the Security tab in the Internet Options, select Local intranet and click on the Sites button. Then disable the Automatically detect intranet network and instead select the individual choices underneath manually. I wonder if we shouldn't drop the OLE browser from ActivePerl; it is hard to get it working, and enabling it leaves you with a security vulnerability unless you can trust all web pages on your local intranet. Note that both Microsoft Visual Studio and Microsoft Office come with Object browsers themselves, so if you have either of them, it might be easier to use those browsers instead (the Win32::OLE browser is basically a re-implementation of the one from Office 97 in Perl and DHTML). Cheers, -Jan From: trill...@gmail.com [mailto:trill...@gmail.com] On Behalf Of w...@serensoft.com Sent: Wednesday, December 16, 2009 3:11 PM To: Jan Dubois Cc: perl-win32-users@listserv.activestate.com Subject: PerlScript OLE browser [was How to simulate VB Casting for $perl_objects via Win32::OLE?] Thanks Jan. We've got the .NET wonks working on just this approach. BTW... what does it take to get the PerlScript OLE browser to work? I tried a quick test (below) and PerlScript is working in IE, but the OLE browser frames are all empty except for the default could not load gripe at the bottom. Is there a start-condition of some sort? (And Initialize and script ActiveX controls not marked as safe is set to Enable for the local intranet zone...) script language=PerlScript $window-{status} = 'Hi from PerlScript!'; # works! /script http://www.xav.com/perl/site/lib/Win32/OLE/Browser/Browser.html file:///C:/Perl/html/lib/Win32/OLE/Browser.html file:///C:\Perl\html\lib\Win32\OLE\Browser.html On Wed, Dec 16, 2009 at 2:10 PM, Jan Dubois j...@activestate.com wrote: Win32::OLE uses late binding (the IDispatch interface, aka OLE Automation); there is no such thing as casting to different objects as there is only a single IDispatch interface per object. This is the same as using Jscript or VBScript, but not VB or C++ which normally use early binding. It is up to the developer of the object to make sure all interfaces are automation accessible. Ask them for sample code in VBScript or VBA. If you cannot access the interfaces from there, then you won't be able to access them via Win32::OLE either. Cheers, -Jan From: perl-win32-users-boun...@listserv.activestate.com [mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of w...@serensoft.com Sent: Wednesday, December 16, 2009 11:40 AM To: perl-win32-users@listserv.ActiveState.com Subject: How to simulate VB Casting for $perl_objects via Win32::OLE? Hi -- Short version: how can we simulate .NET/VB object-type CASTing, in Win32::OLE Perl? Long version: We're building a bridge between a java-web-app and a .net-based-desktop app. Perl is the glue language of choice, of course :) Where we've got trouble is that the .net programmers tell us we need to cast object_1 to be type object_2, and we haven't see how that's done in the Win32::OLE manual pages. For example we start with a Collection, iterate through CoursesCollection-Item(ix) and from there we get a StudentsCollection-Item( foo ) which is a generic object but needs to be CAST as a 'proper' Student object instead. How do we do that in Win32::OLE? my $classes = App-Classes; my $class_ct = $classes-Count; for ( my $class_ix = 1; $class_ix = $class_ct; $class_ix ++ ) { my $class = $classes-Item( $class_ix ); my $students = $class-Students; my $stu_ct = $students-Count; for ( my $stu_ix = 1; $stu_ix = $stu_ct; $stu_ix ++ ) { my $stu = $students-Item( $stu_ix ); # $stu is a GENERIC object here with only basic methods # need to 'cast' it to Student type so we can get grades my $grades = $stu-Grades; # boom! (Name not found, meaning no such method) } } We were hoping the objects were classed somehow inside Perl, but all objects appear to be simply Win32::OLE objects, and even trying to get to the hash keys gives an error... Any pointers/flames welcome. Thanks! -- will trillich Tis the set of the sails / And not the gales / That tells the way we go. -- Ella Wheeler Wilcox -- will trillich Tis the set of the sails / And not the gales / That tells the way we go. -- Ella Wheeler Wilcox ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs