Collection objects should always provide a Count
property (the number of items in the collection) and an
Item method. The Item method is
used to access a particular collection item using a subscript, which
may be an integer or a string, depending on the server. Collection
objects may also optionally contain an Add and a
Remove method.
Collection objects also support a standard COM interface
(IEnumVARIANT) that allows you to enumerate each item in a
collection. It defines methods that let you advance the iteration to
the next item, skip a given item, restart the enumeration, and create
a new copy of the iterator. While all servers are supposed to provide
this interface, some servers don't implement all of
the methods (often Reset and
Clone are not implemented).
$cnt = $coll->Count( );
if( $cnt) {
$obj = $coll->Item(0);
$obj->do_something( );
}
Count will tell you the number of items in the
collection, and Item will return the desired item
as a Win32::OLE object.
For the enumeration methods, you need to create an enumeration object
for the collection object:
$coll = $obj->some_coll( );
$enum = Win32::OLE::Enum->new($coll);