You can save a session by using the subroutine call syntax.

The following code sample shows how to save a session.

Vim::save_session():

...
# usual login procedure with connect()
Util::connect();
...
# save the global session in file .mysession
Vim::save_session(session_file => '.mysession');

Alternatively, you can use save_session() with the object-oriented syntax. See Using Multiple Sessions.

...
# object-oriented login
my $service_url = "https://$server/sdk/vimService";
my $vim = Vim->new(service_url => $service_url);
$vim->login(user_name => $username, password => $password); ...
# save session $vim in file .mysession
$vim->save_session(session_file => '.mysession');

The session remains active until the program runs a log out or disconnect operation, or until the program times out. Time out is 30 minutes after the last operation was performed.