Cloverleaf: install custom Perl modules

Cloverleaf: install custom Perl modules

Cloverleaf: install custom Perl modules 150 150 Roderick Derks

Since 1999 I've been working in the Information Technology business. In these years I've seen a lot of bad software that makes you go crazy. That really makes you appreciate the great software that's out there. For instance VMware and Quovadx Cloverleaf software.

I haven't written any articles about Cloverleaf because it's really a niche market product. It's being used in a lot of hospitals around the world, also the hopital I'm working at. For around 8 years now. Cloverleaf is a intelligent message broker. It makes it fairly easy to connect one system to another system, or one system to many other systems. Almost everything is possible when it comes to message translating and controlling the routes. In my hospital the Cloverleaf plays a crucial role in getting information in the right place on time.

One of the great things is that Cloverleaf uses Perl. That is why I started to learn this language and this was a wise choice because this made my life as a network- and system engineer so much easier. But this all is not what I want to share here.

Cloverleaf is installed on a linux machine in our hospital. We used to run it on Windows but we switched, needless to say I'm really happy with this even though the Windows machine was not so bad at all. But I'm getting of track again. So linux has it's perl environment and Cloverleaf installs its own Perl installation in it's program folder. One of my newly created scripts needs to run in the Cloverleaf Perl environment, and the scripts needs a CPAN module.

Installing the Perl mudule in Cloverleaf Perl environment

I had problems installing this CPAN in the Cloverleaf Perl environment because the searchpaths in @INC were incorrect. While installing the module I got this error:

-bash-3.00$ perl Makefile.PL
Checking if your kit is complete…
Looks good
Warning: PERL_LIB (/work/jerickso/quovadx_dev/qdx5.6P/integrator/lib/perl5/5.8.8) seems not to be a perl library directory
(Exporter.pm not found) at /quovadx/qdx5.6/integrator/lib/perl5/5.8.8/ExtUtils/MM_Unix.pm line 1668.
Have /quovadx/qdx5.6/integrator/lib/perl5/5.8.8/i686-linux/Config.pm expected /work/jerickso/quovadx_dev/qdx5.6P/integrator/lib/perl5/5.8.8/i686-linux/Config.pm
Your perl and your Config.pm seem to have different ideas about the
architecture they are running on.
Perl thinks: [i686-linux]
Config says: [i686-linux]
This may or may not cause problems. Please check your installation of perl
if you have problems building this extension.
Writing Makefile for Net::Telnet
-bash-3.00$ make
make: *** No rule to make target `/work/jerickso/quovadx_dev/qdx5.6P/integrator/lib/perl5/5.8.8/i686-linux/Config.pm', needed by `Makefile'.  Stop.

So what now? I changed the environment variable @INC for perl so that the right libraries would be found:

-bash-3.00$ export PERL5LIB=/quovadx/qdx5.6/integrator/lib/perl5/5.8.8

-bash-3.00$ make clean
rm -f \
*.a core \
core.[0-9] blib/arch/auto/Net/Telnet/extralibs.all \
core.[0-9][0-9] Telnet.bso \
pm_to_blib.ts core.[0-9][0-9][0-9][0-9] \
Telnet.x  \
perl tmon.out \
*.o pm_to_blib \
blib/arch/auto/Net/Telnet/extralibs.ld blibdirs.ts \
core.[0-9][0-9][0-9][0-9][0-9] *perl.core \
core.*perl.*.? Makefile.aperl \
perl Telnet.def \
core.[0-9][0-9][0-9] mon.out \
libTelnet.def perlmain.c \
perl.exe so_locations \
Telnet.exp
rm -rf \
blib
mv Makefile Makefile.old > /dev/null 2>&1
-bash-3.00$ perl Makefile.PL
Checking if your kit is complete…
Looks good
Writing Makefile for Net::Telnet
-bash-3.00$ make
cp lib/Net/Telnet.pm blib/lib/Net/Telnet.pm
Manifying blib/man3/Net::Telnet.3
-bash-3.00$ make test
PERL_DL_NONLAZY=1 /quovadx/qdx5.6/integrator/bin/perl588 "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/select….ok                                                              
All tests successful.
Files=1, Tests=3,  0 wallclock secs ( 0.00 cusr +  0.03 csys =  0.03 CPU)
-bash-3.00$ make install
mkdir /work: Permission denied at /quovadx/qdx5.6/integrator/lib/perl5/5.8.8/ExtUtils/Install.pm line 112
make: *** [pure_site_install] Error 13

We need root rights. As user root:

[root@ezhcom02 ~]# visudo
hci     ALL=(ALL) ALL

As user HCI:
-bash-3.00$ sudo make install
Password:
Installing /work/jerickso/quovadx_dev/qdx5.6P/integrator/lib/perl5/site_perl/5.8.8/Net/Telnet.pm
Installing /work/jerickso/quovadx_dev/qdx5.6P/integrator/man/man3/Net::Telnet.3
Writing /work/jerickso/quovadx_dev/qdx5.6P/integrator/lib/perl5/site_perl/5.8.8/i686-linux/auto/Net/Telnet/.packlist
Appending installation info to /work/jerickso/quovadx_dev/qdx5.6P/integrator/lib/perl5/5.8.8/i686-linux/perllocal.pod

As user root:
[root@ezhcom02 ~]# cp /work/jerickso/quovadx_dev/qdx5.6P/integrator/lib/perl5/site_perl/5.8.8/Net/Telnet.pm /quovadx/qdx5.6/integrator/lib/perl5/site_perl/5.8.8/Net/
cp: overwrite `/quovadx/qdx5.6/integrator/lib/perl5/site_perl/5.8.8/Net/Telnet.pm'? y

As user root:
[root@ezhcom02 ~]# visudo
#hci     ALL=(ALL) ALL

As user HCI I can now run the script that needs this module:
-bash-3.00$ /quovadx/qdx5.6/integrator/bin/perl /quovadx/qdx5.6/integrator/ezh_scripts/bin/restart_windows_service.pl -c ezhappl04 -u "elisabeth\username" -p **** -s AstraiaHL7Server

Cloverleaf Alert Manager

Now the last problem:  I would like to start this perl script from the Alert Manager inside Cloverleaf, but it doesn't. You first have to do one more action. Start the perl script from a Bash Shell script and add the PERL5LIB variabele. Start this shell script from the Alert manager.

[root@ezhcom02 ~] vi restart_windows_service.sh
export PERL5LIB=/quovadx/qdx5.6/integrator/lib/perl5/5.8.8
/usr/bin/perl /quovadx/qdx5.6/integrator/ezh_scripts/bin/restart_windows_service.pl $1 $2 $3 "$4" $5 $6 $7 "$8" >/tmp/restartwindowsservice 2>&1

That's it. It took me hours to find this solution, but it saves me work every day.

 

————————

nvt maar leukvoorlater:

#regel dat de HCI user de juiste PERL ENV heeft:
# foreach $key (sort(keys %ENV)) {
#          #print $key, '=', $ENV{$key}, "\n";
#          $$key = "$ENV{$key}";
# }

# if ( $HOME =~ "hci" ) {
#    use lib "/usr/lib/perl5/5.8.5";
#    use lib "/usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi";
#    use lib "/usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi/ModPerl";
#    use lib "/usr/lib/perl5/5.8.5/i386-linux-thread-multi";
#    use lib "/usr/lib/perl5/5.8.5/i386-linux-thread-multi";
# }
 

Tip: client configuration to expand memory to be able to read large smatfiles: -Xmx256m

Roderick Derks

Liefhebber van fietsen, van het oplossen van IT puzzels, en van het delen van informatie om anderen te helpen.

All stories by:Roderick Derks

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

    Your Name (required)

    Your Email (required)

    Subject

    Your Message

      Your Name (required)

      Your Email (required)

      Subject

      Your Message