Hi,
Has anyone been able to install CPAN with microperl? or can anyone help me with geting this working? I am using x86 version of OpenWrt, I have been able to re-compile it with all the modules I needed, but am struggling with one of my perl scripts and was wondering if "use IO::Handle; or Device::Serial " might be a better way of getting it to work.
here is the script I am struggling with:
#!/usr/bin/microperl
# program to test a printer with buttons on it.
my $port = "/dev/tts/0";
$url="http://xxx.yyy.zzz";
system("stty 9600 -parenb -parodd cs8 -hupcl -cstopb cread clocal -crtscts ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff -iuclc -ixany -imaxbel -opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0 -isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase -tostop -echoprt -echoctl -echoke < $port");
open(SERPORT,"+>$port") or die "can't open serial port";
while (true)
{
sysread (SERPORT,$buffer,5);
if ($buffer =~ /^\(\w+\)/)
{
#button request is valid
$buffer = ~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg;
$curl = "curl -s $url?button=$buffer";
$text = `$curl`;
@wordlist = split(//,$text);
foreach $word(@wordlist){ print SERPORT $word; }
}
else
{
#button request is invalid
}
}