winIDEA SDK
Perl specifics

isystem.test interface for Perl is slightly different from other languages (the reason is missing support for C++ shared pointers in interface generator tool).

We have to keep two references to the same object. The first is reference to the shared pointer object, which keeps reference count, but has no access to object's methods. The other is a reference to the object itself, which provides access to object's methods. Because the shared pointer object counts references, it is important that the shared pinter object does not get out of scope when object reference is still used.

Example:

To load test specifications form file, we can use static method of CTestBench:

    my $testBenchSP = isystemConnect::CTestBench::load($testSpecificationFile);

We've got a shared pointer object, as can be seen from API doc for CTestBench class. To call methods on this object, we have to get object reference from the shared pointer as follows:

    my $testBench = isystemConnect::CTestBenchSP::s2r($testBenchSP);

Static methods s2r() are defined for all isystem.test container classes (note the postfix SP in class name).
Now we can call methods of $testBench:

        my $testEnvConfigSP = $testBench->getTestEnvironmentConfig();

As mentioned above, $testBenchSP must not go out of scope as long as $testBench is used, otherwise Perl will crash.

Tip: To make usage more obvious, all shared pointer types in C++ end with SPtr. It is advised to use similar naming in Perl scripts, as postfix SP is used above, for example.