To submit a request to a STAF service within a Perl script, you must first
register with STAF to get a STAF handle to use to submit the request. You
can use this STAF handle to submit any number of STAF service requests.
You are also responsible for unregistering the STAF handle. Here's an
example of a Perl script that works fine:
use PLSTAF;
# Register with STAF and get a STAF handle
$handle = STAF::STAFHandle->new("MyTestHandle");
if ($handle->{rc} != $STAF::kOk) {
print "Error registering with STAF, RC: $handle->{rc}\n";
exit $handle->{rc};
}
# Submit a STAF local PING PING request
$rc = STAF::Submit("local", "ping", "ping");
print "RC: $rc, Result: $STAF::Result";
# Unregister the handle
print "\nUnregistering handle $handle->{handle}\n";
$rc = $handle->unRegister();
if ($rc != $STAF::kOk) {
print "Error unregistering with STAF, RC: $STAF::RC\n";
exit $rc;
}
Here's a sample result when running this Perl script:
C:\>perl testPing.pl
RC: 0, Result: PONG
Unregistering handle 63
C:\>
See the STAF Perl User's Guide at
http://staf.sourceforge.net/current/STAFPerl.htm for more information on
using the STAF Perl APIs and for many examples.
--------------------------------------------------------------
Sharon Lucas
IBM Austin, luc...@us.ibm.com
(512) 286-7313 or Tieline 363-7313
Re: [staf-users] Uninitialized value in subroutine error
Lap Vong
to:
'staf-users@lists.sourceforge.net'
07/30/2010 01:44 PM
Can someone provide clue to why I am getting this error from a simple staf
command?
Code:
1. use PLSTAF;
2. my $rc = STAF::Submit("local", "ping", "ping");
Return:
"Use of unintialized value in subroutine entry at test.pl line 2."
Command: "staf local ping ping" returns proper response.
Original issue found from calling VMSTAF.pm which in turn calls
STAF::Submit() function.
Thanks.
Lap
------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users
------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users