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

Good day bros. I am trying to use Win32::OLE to access an old VSS 6.0 repository. Based on a node I found about this I tried
#!/usr/bin/perl -w use strict; use Win32::OLE; my $vss = Win32::OLE->new('SourceSafe.0'); $vss->Open('C:\VSS\srcsafe.ini', 'admin', ''); # error checking if (Win32::OLE->LastError() != 0){ print 'Error: ', Win32::OLE->LastError(); }
but I got
Win32::OLE operating in debugging mode: _Unique => 1 Win32::OLE(0.1709) error 0x80040154: "Class not registered" at C:\User +s\boss\VSS-analysis\accessvss.pl line 4. eval {...} called at C:\Users\boss\VSS-analysis\accessvss.pl line +4 Can't call method "Open" on an undefined value at C:\Users\boss\VSS-an +alysis\accessvss.pl line 9.
Any advice on how to proceed?

Replies are listed 'Best First'.
Re: Win32::OLE to access VSS repo?
by Lotus1 (Vicar) on Dec 16, 2016 at 18:20 UTC

    I've had good results with the command line interface to VSS, ss.exe, by shelling out from Perl. I've automated things like checking out files and running Perl scripts against them then checking them back in. The available command line options are documented in the help files.

    Edit: Your link to the previous node seems to be broken.

    Edit: Here are some examples:

    sub checkout_sse_file { my ($checkout_path, $filename) = @_; if($checkout_path !~ /[\/\\]$/) { $checkout_path .= '\\'; } my $sspath= 'C:\Program Files (x86)\Microsoft Visual Studio\VSS\wi +n32'; $ENV{SSDIR}="\\\\servername\\dms-sourcesafe"; my $cmd = "\"$sspath\\ss.exe\" Checkout \"\$/DMS MW/SCADA/Substati +on Editor Files/$filename\" -C- -I- -GL\"$checkout_path \""; #print "\n********************\n\$cmd=$cmd\n"; # if the file is already there it doesn't download it again. # BUT, it won't overwrite a file unless the read-only bit is set. system $cmd; return $? >> 8; } sub checkin_sse_file { my ($checkout_path, $filename, $comment) = @_; if($checkout_path !~ /[\/\\]$/) { $checkout_path .= '\\'; } my $sspath= 'C:\Program Files (x86)\Microsoft Visual Studio\VSS\wi +n32'; $ENV{SSDIR}="\\\\servername\\dms-sourcesafe"; my $cmd = "\"$sspath\\ss.exe\" Checkin \"\$/DMS MW/SCADA/Substatio +n Editor Files/$filename\" -C\"$comment\" -I- -GL\"$checkout_path \"" +; system $cmd; return $? >> 8; }
      Thanks, I didn't even know about ss.exe. I will check it out.

      I don't know what's wrong with that node link. The URL is http://perlmonks.org/?node_id=202709 and I used id//202709 for the link.

        "I don't know what's wrong with that node link. The URL is http://perlmonks.org/?node_id=202709 and I used id//202709 for the link."

        It's just a typo. You've omitted the colon between id and // so, instead of your intended query string

        ?node_id=202709

        you're getting

        ?node=id%2F%2F202709

        — Ken

        [id://202709]
        ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,
Re: Win32::OLE to access VSS repo?
by Anonymous Monk on Dec 16, 2016 at 09:54 UTC
Re: Win32::OLE to access VSS repo?
by cormanaz (Deacon) on Dec 15, 2016 at 23:14 UTC
    As further info...It seems this error is related to trying to access a 32-bit dll with a 64-bit Perl app. I found this about how to create a registered component, but not sure what .dll to target. Possibilities are SSVB.DLL, SSUS16.DLL, SSSCC.DLL,SSGUI.DLL, and SSAPI.DLL. I'm guessing maybe the SSVB one, but not sure. If anyone knows, would appreciate guidance.
Re: Win32::OLE to access VSS repo?
by Anonymous Monk on Dec 16, 2016 at 00:02 UTC
    Why? What do you want to do with the data? Hopefully you want to export it out of stupid Microsoft products and into something smart like git, right? Surely you can check out the entire project into a directory and just check it into git and be done. The link you referenced is broken by the way, here is the link for reference: PERL OLE connection to VSS from 2002. 12 years ago!

    Let's stop using Microsoft products because they are awful and leave you stranded like you are now.

      "Let's stop using Microsoft products because they are awful and leave you stranded like you are now."

      I'd just like to point out here that many of the people here on Perlmonks (as well as other help sites) are asking about problems they face at work, and many companies (most if we're talking medium-large) have policies in place which dictate what software/processes/etc must be used. This means that for many, ditching entire platforms and vendors is out of the question.

      Relax. I am not using VSS. I'm doing research on a project that used VSS 12 years ago. Trying to get whatever info I can about coding activity on the project, i.e. number of lines present in each version, adds, deletes, changes. It takes a lot of clicks to do that on VSS, and there are a lot of branches in the repo, so looking for an automated solution.

      2016 - 2002 = 14.