The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

VSS - Visual Source Safe Class

SYNOPSIS

        use VSS;

        my $vss = VSS->new(db_path => 'L:/',
                    username => 'foo',
                    password => 'bar',
                    vss_base => '$/Development/');

        my $item = $vss->checkout('src/main.c');
        $item = $vss->checkin($item);

        $vss->share_and_branch('cmvdbc.htm.xml', '$/Production/cmvdbc.htm.xml');

WARNING

PLEASE DO NOT USE MICROSOFT VISUAL SOURCE SAFE UNLESS YOU HAVE TO!! It is horrible software and pcvs or cvs or anything else is recommended. If you are so unlucky as to have to use this all you need to know is what's outlined below. You might also want to check out http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvss/html/msdn_vssole.asp

ARGUMENTS

The following arguments can be passed to this module:

db_path

The path to your srcsafe.ini file. In some versions of VSS you may need to pass the name of the directory that contains the srcsafe.ini file.

username

The username you use to log into VSS.

password

The password you use to log into VSS.

vss_base

This is an optional, but recommended parameter. The function of such is for the _itemize and _itemize_name functions allowing you to say things like 'project/file.c' instead of '$/Development/project/file.c'. In that case you would set vss_base to '$Development/'. Simple, huh? ;)

debug

Set to 1 to debug.

METHODS

Before we begin I should tell you that all parameters that are supposed to be a VSS item will do its best to become a VSS item. What I mean is that every time you pass an argument that requires an item or item name, it will be run through one of the functions _itemize or _itemize_name. These are meant to be called only from the module, but I feel free to use them in your scripts (though I won't document it here, for simplicity's sake). The functions do thier best to turn a [full|partial] textual description into a VSS item or VSS item name.

item_exists

Pretty self-explanatory. If the function can obtain an item from the item name passed, it returns 1 otherwise 0.

checkin

Arguments:

  1. VSS item or [full|partial] item name [required]

  2. Comment [optional]

Returns: VSS Item

checkout

Arguments:

  1. VSS item or [full|partial] item name [required]

  2. Comment [optional]

Returns: VSS Item or undef if checked out

local_file

Arguments:

  1. VSS item or [full|partial] item name [required]

Returns: Local file name

I'm not sure this function works X(.

share_and_branch

Arguments:

  1. VSS item or [full|partial] item name representing the FROM item [required]

  2. VSS item or [full|partial] item name representing the TO item [required]

  3. AutoCheckIn 1 or 0. Determines if the function should checkin checked-out files. [optional] [default:0]

Returns: 0 upon success; error string upon failure.

branch

Arguments:

  1. VSS item or [full|partial] item name representing the file or project that was shared into. [required]

Returns: nothing

share

Arguments:

  1. VSS item or [full|partial] item name representing the FROM item [required]

  2. VSS item or [full|partial] item name representing the TO item [required]

  3. DeleteIfExists 1 or 0. Determines if the function should delete existing TO items. [optional] [default:0]

Returns: 0 upon success; error string upon failure.

destroy

Arguments:

  1. VSS item or [full|partial] item name representing the item to be destroyed [required]

Returns: nothing

add

Arguments:

  1. VSS item or [full|partial] item name representing the directory to add into. [required]

  2. Local file (full path, windows convention - use backslashes) to add. [required]

If the director(y|ies) you're adding to don't exists, don't worry. This will call add_directories to add them into VSS.

add_directories

Arguments:

  1. VSS item or [full|partial] item name representing the director(y|ies) to create. [required]

This function will create all the directories named, or none if they already exist.

update

Arguments:

  1. VSS item or [full|partial] item name representing the directory to add into. [required]

  2. Local file name only (not the path name). Must match the end of the next parameter. [required]

  3. Local file (full path/file name, windows convention - use backslashes) to add. [required]

This function will check out the file if it exists and copy the specified local file to in before checking it back in, thus updating it. If the item does not exist, it simply calls the add method.

BUGS

Plenty, but they're all within MS VSS itself so they'll never get resolved :). If you do find a bug, let me know.

SEE ALSO

WIN32::OLE http://msdn.microsoft.com/library/en-us/dnvss/html/vssauto.asp http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvss/html/msdn_vssole.asp

CREDITS

Thanks to Shaun-lost-his-full-name-and-email-address for the update from Version 1.0.2 to Version 1.0.3. He removed the hardcoded defaults and instead searched the registry for the values that the shell uses via Win32::TieRegistry. Very cool!

AUTHOR

BPrudent (Brandon Prudent)

email: xlacklusterx@hotmail.com