Use of the RT::LocalPath variable

We have a locally developed script that uses the RT API. We also have
some local modifications to RT which are all kept under the directory
in the RT::LocalPath variable (which in the NetBSD pkgsrc’d version of RT
that we run, has been set to /var/rt3).

Our local modifications work fine for any operations done through the
web server (ie: interactively with a browser, or through the mailgate).
But I’ve just noticed that they aren’t working when our script invokes RT
via the API.

I think this is due to the fact that the only place where the lib directory
under /var/rt3 is added to the perl library search path is in the webmux.pl
script, which I assume isn’t used when the API is called. In fact, even
in webmux.pl RT::LocalPath is not used – rather, the value of the
RT_LOCAL_PATH variable is substituted during the installation process.

So is it required that any scripts that use the RT API must explicitly add
the local path to the perl library search path themselves? If so, is there
any nice way of doing it by referring to RT::LocalPath rather than the
literal string itself (in my case “/var/rt3/lib”). I don’t think the obvious

use ($RT::LocalPath . "/lib");

will work because $RT::LocalPath will not be set until perl starts to execute
the library code, which will be too late.

This is all on a NetBSD system running RT 3.4.5 from NetBSD’s pkgsrc version
of RT, but I don’t think the pkgsrc version has made any alterations in this
particular area of the code.

Thanks for any advice,

Duncan