OpenWrt Forum Archive

Topic: CPAN and microperl

The content of this topic has been archived on 30 Mar 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

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
    }
}

I can get microperl to work but when I try to use any CPAN stuff it can't find many .pm files.  I've come to a head when I could not figure out which Config.pm file we need for OpenWRT.

(Last edited by mrdvt92 on 14 Mar 2006, 05:11)

There is a full perl release, including many CPAN modules - hust search the forum.

If some CPAN modules are missing, they can be easily copied (or built for some) from CPAN.

I searched before but will try again - thanks for the tip.  Can you recall if the Full Perl release is for the x86 version and not just the wrt54g version? - cheers

whitespirit wrote:

Can you recall if the Full Perl release is for the x86 version and not just the wrt54g version?

It's MIP.  I installed it yesterday.  Works great.  I needed LPW for web stuff and boy there were a bunch of additional .pm files that I needed from CPAN.  But, my project works great now.

I used the perl from frol http://forum.openwrt.org/viewtopic.php?id=4122

on to pl2303...

Mike (mrdvt92)

The discussion might have continued from here.