The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

VCS::CMSynergy::Helper - ancillary convenience functions

SYNOPSIS

my $ccm_opts = VCS::CMSynergy::Helper::GetOptions;

GetOptions

This function extracts a set of common options from @ARGV and converts them to the corresponding options for "new" in VCS::CMSynergy. All options and arguments in @ARGV that it doesn't know about are left untouched.

It may be used to make all your Synergy scripts accept a uniform set of options:

use Getopt::Long;
use Pod::Usage;
use VCS::CMSynergy;
use VCS::CMSynergy::Helper;
...

# extract Synergy options from @ARGV
my $ccm_opts = VCS::CMSynergy::Helper::GetOptions or pod2usage();

# process other options in @ARGV
GetOptions(...) or pod2usage();

# start Synergy session
my $ccm = VCS::CMSynergy->new(
    %$ccm_opts,
    RaiseError => 1,
    PrintError => 0);
...

The following options are recognized:

-D, --database

absolute database path; this option corresponds to option database for VCS::CMSynergy/start

-S, --server

server URL; this option corresponds to option server for for VCS::CMSynergy/start

-U, --user

user; this option corresponds to option user for VCS::CMSynergy/start

-P, --password

user's password; this option corresponds to option password for for VCS::CMSynergy/start

GetOptions returns a reference to a hash of options suitable for passing to "new" in VCS::CMSynergy. If no --database is specified

CCM_ADDR => $ENV{CCM_ADDR}

is added to the hash.

If any error is encountered during option processing the error is signalled using warn() and undef is returned.

Note that all recognized single letter options are in uppercase so that scripts using VCS::CMSynergy::Helper::GetOptions still can use all lowercase letters for their own options.

Here's the short description of recognized options that you can cut and paste into your script's POD:

Synergy Options:

-D PATH | --database PATH       database path
-S URL | --server URL           server URL
-U NAME | --user NAME           user name
-P STRING | --password STRING   user's password