$session = InCharge::session->init( );

This funtion is the simplified version of InCharge::session->new(). It parses the script’s command line, looking for options that specify the Broker, Domain Manager username, password, trace, timeout, and locale options. Then it invokes the primitive InCharge::session->new() with those arguments and passes back the result.

InCharge::session->init() looks for the following script command line arguments.

 --broker=<brokerIP[:bokerPort]>   (also: -b)
 --server=<domain-name>            (also: -s)
 --user=<username>                 (also: -u)
 --password=<password>             (also: -p)
 --traceServer
 --timeout
 --locale=<locale>

If neither the --user (or -u) and --password (or -p) are specified, the script makes use of the SM_HOME/conf/clientConnect.conf file to determine the username and password to be employed. Comments are included in the file for detailing this mechanism. This mechanism is turned on by specifying the value <STD> for the SM_AUTHORITY environment variable.

If the InCharge::session->init() functions encounters a command line syntax error, it calls usageError, in the main script, which the developer must provide. A single large text string that contains a description of the standard options handled is passed as the argument to usageError, which enables the author to include information about the standard options as well as any nonstandard ones provided. If the usageError subroutine does not exist, a default error message is printed on STDERR.

Note that the init() function consumes (removes) the command line arguments it handles from @ARGV as it processes them. Therefore you can access the @ARGV array after its execution to process additional arguments without needing to skip the standard ones. However, you cannot use the init command twice in the same script without first saving and restoring the contents @ARGV, as in the example:

 @SAVE = @ARGV;
 $session1 = InCharge::session->init( );
 @ARGV = @SAVE;
 $session2 = InCharge::session->init( );

The locale argument to the InCharge::session init method allows you to set the locale of the session (the client locale).

Note:

You can use the InCharge::session->setLocale() method to change the locale for the session, while it is connected.

The default locale to set for a Perl client is determined as follows:

  1. The value of the SM_LOCALE environment variable.

  2. If the SM_LOCALE variable is not set, then the default isen_US.