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

Reply via email to