Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Decoding OLE::Variant

by meetraz (Hermit)
on Oct 31, 2005 at 22:02 UTC ( [id://504437]=note: print w/replies, xml ) Need Help??


in reply to Decoding OLE::Variant

The problem is that Drive and ParentFolder are themselves objects, with references to other objects, so you have to decide how many levels you want to go down.. Here's an example of going one more level down, but note you'll still get some hash messages in your output, because the drive object references a folder object, and each folder object references a drive, other folders, other files, etc.


use strict; use warnings 'all'; use Win32; use Win32::OLE; use Win32::OLE::Variant; my $fso = Win32::OLE->new( 'Scripting.FileSystemObject' ); Win32::OLE->Option( Warn => 0 ); my $file = $fso->GetFile("c:\\perl\\bin\\perl.exe"); foreach my $key (keys %$file) { my $value = $file->{$key}; if (ref($value) eq 'Win32::OLE') { foreach my $subkey (keys %$value) { print "$key : $subkey : $value->{$subkey}\n"; } } else { print "$key : $value\n"; } }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://504437]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-04-24 20:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found