in reply to Re: Win32::API cant define function
in thread Win32::API cant define function
Thank you for your feed back but I still can not get it to work. I am kind of a nubie when it comes to Perl. The function that reads in is actually called ReadInputs not SetOutputs but I guess that was just a typo.
I have pasted the code I am trying to get to work below. The code is suppost to print out what ReadInputs has read every second. The error that I am getting in command prompt is "Not a Code reference at line 20" and it's talking about "my $rv = $read_inputs->($buf);"
use strict; use Win32::API; Win32::API->Import("wsp", "int InitWasp()"); my $read_inputs = Win32::API->new("wsp", "ReadInputs", "P", "I"); InitWasp(); #connect to WASP USB board #constant input read in # while(1){ print ReadInputs()."\n"; sleep(1); } #Subroutines # sub ReadInputs{ my $buf = "\x00" x (4 * 32/8); my $rv = $read_inputs->($buf); return ($rv, unpack('l4', $buf)); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Win32::API cant define function
by GrandFather (Saint) on Mar 29, 2010 at 01:09 UTC |