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 <[email protected]> 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:* [email protected] [mailto:
> [email protected]] *On Behalf Of *
> [email protected]
> *Sent:* Wednesday, December 16, 2009 11:40 AM
> *To:* [email protected]
> *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
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs