Hi
I'm trying a Perl staf service (provided at section 7 of http://staf.sourceforge.net/current/stafsdg.html#Header_Perl) On MAC OS X, with STAF 3.4.23 and Perl V5.18.2. I'm getting following error on STAFProc window when I add the service dynamically;
STAFProc version 3.4.23 initialized
Subroutine STAF::Register redefined at /Applications/staf/bin/PLSTAFService.pm line 41.
Subroutine STAF::UnRegister redefined at /Applications/staf/bin/PLSTAFService.pm line 41.
Subroutine STAF::Submit redefined at /Applications/staf/bin/PLSTAFService.pm line 41.
I had to comment line #41 in PLSTAFService.pm to get rid of above error/warnings. Inspite of that, i'm unable to get the sample service commands working. I see the commands are hung!, and I do NOT see any errors at STAFProc window. Following are my ENV vars when I invoked above. Please help me get rid of this.
If any appropriate Perl and STAF version to be used, please suggest. I also tried perl 5.10 and STAF 3.3.4 on Centos linux (all 64bit) , but no luck. I see same behaviour!!
Thanks,
-Srinivas
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
On my Mac OS X 10.10 system running STAF V3.4.23 (installed in the default location of /Library/staf) and with STAF Support for Perl 5.18 installed (selected during the STAF install), I can register the sample STAF Perl service using Perl 5.18.2 (provided with Mac OS X 10.10). Here's what I did:
Note that you need to have selected to install STAF support for Perl 5.18 during the STAF installation process so that the /Library/staf/lib/perl518/libPLSTAF.dylib file is copied to the /Librarystaf/lib directory (or you can copy this file yourself).
Then I started STAFProc (using startSTAFProc.sh in /Library/staf) AFTER these environment variables have been set:
# pwd
/Library/staf
# ./startSTAFProc.sh
# appending output to nohup.out
# tail nohup.out
Machine : staf4f.company.com
Machine nickname : staf4f.company.com
Startup time : 20151201-15:17:04
STAFProc version 3.4.23 initialized
I created directory /Library/staf/services/DeviceService and copied DeviceService.pm in this directory. Then I dynamically registered this sample STAF Perl service successfully as follows:
# STAF local SERVICE ADD SERVICE Sample LIBRARY STAFEXECPROXY EXECUTE DeviceService OPTION PROXYLIBRARY=PLSTAF OPTION USELIB=/Library/staf/services/DeviceService
Response
--------
And verified that I could submit a HELP request to this STAF Perl service:
# STAF local Sample HELP
Response
--------
DeviceService Service Help
ADD (PRINTER <printerName> | MODEM <modemName>) MODEL <model> SN <serial#>
DELETE PRINTER <printerName> | MODEM <modemName> CONFIRM
LIST [PRINTERS] [MODEMS]
QUERY PRINTER <printerName> | MODEM <modemName>
VERSION
HELP
#
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I did not make any changes to PLSTAFService.pm. I also see the warnings you saw in the STAFProc output in nohup.out but requests submitted to the STAF Perl service are successful.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Great, glad your STAF Perl service is registering now on Mac OS X and Linux 64-bit.
I'm adding the information for how to use the default Perl 5.10 instead of ActivePerl with STAF Perl services on Linux (that I sent you privately) in case it is of value to other STAF users:
You should be able to use the default Perl 5.10.1 installed on your Linux system instead of ActivePerl with STAF's Perl support with a few more environment variable changes as I'll show below. We chose to build STAF Perl support using ActivePerl versions on some operating systems as it was readily available (and free at the time) and easy to install multiple Perl versions on a single system using ActivePerl. But, you can build STAF Perl support using your system's default Perl version in the future and then you wouldn't have to set the path to the libperl.so file in LD_LIBRARY_PATH or set LD_PRELOAD to your libperl.so file.
Here's an example of using the default Perl version (5.10.1) on a Linux 32-bit system (RHEL Server 6.7) with STAF 3.4.23 for Linux 32-bit installed at /usr/local/staf. You should be able to get STAF Perl 5.10 support on Linux 64-bit to work in a similar way. Just update the path names as needed for where the Perl 5.10 files are located on your system. I just didn't have a Linux 64-bit system with default Perl 5.10 installed available to me.
1) Make sure that Perl 5.10 is the default perl version.
# perl -v
This is perl, v5.10.1 (*) built for i386-linux-thread-multi
Copyright 1987-2009, Larry Wall
...
2) Make sure that the /usr/local/staf/lib directory contains the libPLSTAF.so file for STAF Perl 5.10 support (can manually copy /usr/local/staf/lib/perl5.10/libPLSTAF.so to /usr/local/staf/lib/libPLSTAF.so if you didn't select STAF Perl 5.10 support to be installed when you installed STAF. Set PERLLIB to contain /usr/local/staf/bin and /usr/local/staf/lib.
3) In addition to the default STAF environment variable settings required for STAF (e.g. PATH contains /usr/local/staf/bin and LD_LIBRARY_PATH contains /usr/local/staf/lib), also add the path to the libperl.so file for Perl 5.10 (/usr/lib/perl5/5.10.0/i386-linux-thread-multi/CORE) to the LD_LIBRARY_PATH environment variable:
5) Start STAFProc after setting the above environment variables:
# cd /usr/local/staf
# ./startSTAFProc.sh
# nohup: appending output to `nohup.out'
# tail nohup.outSTAFProc version 3.4.23 initialized
Machine : staf1g.company.com
Machine nickname : staf1g.company.com
Startup time : 20151202-16:06:00
STAFProc version 3.4.23 initialized
6) Dynamically (or in the STAF.cfg file) register the sample Perl service. Note that I put DeviceService.pm in a directory I created named /usr/local/staf/services/DeviceService:
# STAF local SERVICE ADD SERVICE Sample LIBRARY STAFEXECPROXY EXECUTE DeviceService OPTION PROXYLIBRARY=PLSTAF OPTION USELIB=/usr/local/staf/services/DeviceService
Response
--------
7) Submit a request to the Perl service to verify it works:
# STAF local Sample HELP
Response
--------
DeviceService Service Help
ADD (PRINTER <printerName> | MODEM <modemName>) MODEL <model> SN <serial#>
DELETE PRINTER <printerName> | MODEM <modemName> CONFIRM
LIST [PRINTERS] [MODEMS]
QUERY PRINTER <printerName> | MODEM <modemName>
VERSION
HELP
#
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi
I'm trying a Perl staf service (provided at section 7 of http://staf.sourceforge.net/current/stafsdg.html#Header_Perl) On MAC OS X, with STAF 3.4.23 and Perl V5.18.2. I'm getting following error on STAFProc window when I add the service dynamically;
[tsrinivas-mbp:/Applications/staf/bin] tsrinivas% ./STAFProc
Machine : tsrinivas-mbp
Machine nickname : tsrinivas-mbp
Startup time : 20151129-07:34:10
STAFProc version 3.4.23 initialized
Subroutine STAF::Register redefined at /Applications/staf/bin/PLSTAFService.pm line 41.
Subroutine STAF::UnRegister redefined at /Applications/staf/bin/PLSTAFService.pm line 41.
Subroutine STAF::Submit redefined at /Applications/staf/bin/PLSTAFService.pm line 41.
I had to comment line #41 in PLSTAFService.pm to get rid of above error/warnings. Inspite of that, i'm unable to get the sample service commands working. I see the commands are hung!, and I do NOT see any errors at STAFProc window. Following are my ENV vars when I invoked above. Please help me get rid of this.
setenv DYLD_LIBRARY_PATH /Applications/staf/lib/
setenv STAFCONVDIR /Applications/staf/codepage
setenv PERLLIB /Applications/staf/bin
setenv PATH /Applications/staf/bin:$PATH
If any appropriate Perl and STAF version to be used, please suggest. I also tried perl 5.10 and STAF 3.3.4 on Centos linux (all 64bit) , but no luck. I see same behaviour!!
Thanks,
-Srinivas
On my Mac OS X 10.10 system running STAF V3.4.23 (installed in the default location of /Library/staf) and with STAF Support for Perl 5.18 installed (selected during the STAF install), I can register the sample STAF Perl service using Perl 5.18.2 (provided with Mac OS X 10.10). Here's what I did:
I have the following environment variables set for STAF as follows:
Note that you need to have selected to install STAF support for Perl 5.18 during the STAF installation process so that the /Library/staf/lib/perl518/libPLSTAF.dylib file is copied to the /Librarystaf/lib directory (or you can copy this file yourself).
Then I started STAFProc (using startSTAFProc.sh in /Library/staf) AFTER these environment variables have been set:
I created directory /Library/staf/services/DeviceService and copied DeviceService.pm in this directory. Then I dynamically registered this sample STAF Perl service successfully as follows:
And verified that I could submit a HELP request to this STAF Perl service:
I did not make any changes to PLSTAFService.pm. I also see the warnings you saw in the STAFProc output in nohup.out but requests submitted to the STAF Perl service are successful.
Thanks a lot Sharon. I was going wrong at setting LD_LIBRARY_PATH and LD_PRELOAD.
Its working fine now.Thanks!
Great, glad your STAF Perl service is registering now on Mac OS X and Linux 64-bit.
I'm adding the information for how to use the default Perl 5.10 instead of ActivePerl with STAF Perl services on Linux (that I sent you privately) in case it is of value to other STAF users:
You should be able to use the default Perl 5.10.1 installed on your Linux system instead of ActivePerl with STAF's Perl support with a few more environment variable changes as I'll show below. We chose to build STAF Perl support using ActivePerl versions on some operating systems as it was readily available (and free at the time) and easy to install multiple Perl versions on a single system using ActivePerl. But, you can build STAF Perl support using your system's default Perl version in the future and then you wouldn't have to set the path to the libperl.so file in LD_LIBRARY_PATH or set LD_PRELOAD to your libperl.so file.
Here's an example of using the default Perl version (5.10.1) on a Linux 32-bit system (RHEL Server 6.7) with STAF 3.4.23 for Linux 32-bit installed at /usr/local/staf. You should be able to get STAF Perl 5.10 support on Linux 64-bit to work in a similar way. Just update the path names as needed for where the Perl 5.10 files are located on your system. I just didn't have a Linux 64-bit system with default Perl 5.10 installed available to me.
1) Make sure that Perl 5.10 is the default perl version.
2) Make sure that the /usr/local/staf/lib directory contains the libPLSTAF.so file for STAF Perl 5.10 support (can manually copy /usr/local/staf/lib/perl5.10/libPLSTAF.so to /usr/local/staf/lib/libPLSTAF.so if you didn't select STAF Perl 5.10 support to be installed when you installed STAF. Set PERLLIB to contain /usr/local/staf/bin and /usr/local/staf/lib.
3) In addition to the default STAF environment variable settings required for STAF (e.g. PATH contains /usr/local/staf/bin and LD_LIBRARY_PATH contains /usr/local/staf/lib), also add the path to the libperl.so file for Perl 5.10 (/usr/lib/perl5/5.10.0/i386-linux-thread-multi/CORE) to the LD_LIBRARY_PATH environment variable:
4) Set LD_PRELOAD environment variable to the libperl.so file for Perl 5.10:
5) Start STAFProc after setting the above environment variables:
6) Dynamically (or in the STAF.cfg file) register the sample Perl service. Note that I put DeviceService.pm in a directory I created named /usr/local/staf/services/DeviceService:
7) Submit a request to the Perl service to verify it works: