Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

PERL OLE connection to VSS

by Anonymous Monk
on Oct 04, 2002 at 10:07 UTC ( [id://202709]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi,
I'm trying to use PERL to automate some tasks in MS Visual Source Safe, via OLE.
However, I can't make the link between the newly created Win32::OLE object and the methods and properties documented for SourceSafe by MS ...
i.e. I'm a PERL beginner stuck at a pretty basic hurdle I presume!

This is what I've got:
use Win32::OLE; $vss = Win32::OLE->new('SourceSafe') or die "Can't start VSS"; $vssdb = $vss->VSSDatabase->Open($path, $user, $pwd) or die "Failed";

This fails at the last line: Can't call method "Open" on an undefined value.

Here are my questions:
i) What's specifically wrong with the above?
ii) Is there a way to discover the methods and properties available for the object returned by Win32::OLE->new()?

Thanks,
Tim

Replies are listed 'Best First'.
Re: PERL OLE connection to VSS
by zakb (Pilgrim) on Oct 04, 2002 at 10:51 UTC

    You will want to add 'use strict;' to the top of your code and turn on warnings using the -w command line flag or 'use warnings;'. This will help you pinpoint many syntactical and other errors. See here and here for why.

    You're pretty much there with your existing code, a few slight adjustments should make it work:

    # the object name is actually SourceSafe.0 my $vss = Win32::OLE->new('SourceSafe.0'); # you must include the path and filename # of the vss ini file you want, e.g. # c:\data\sourcesafe\dev\srcsafe.ini $vss->Open($srcsafe_ini, $user, $pwd); # error checking if (Win32::OLE->LastError() != 0) { print 'Error: ', Win32::OLE->LastError(); }
    If you're using the Activestate distribution, you should be able to use the HTML OLE Browser to see properties and methods available.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (8)
As of 2024-04-18 10:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found