Community discussions

MikroTik App

Search found 4 matches

by nodeny
Wed May 06, 2009 12:03 pm
Forum: Scripting
Topic: perl API client
Replies: 107
Views: 57340

Re: perl API client

if ($word =~ /!done/)
{
    $retval = 1;
}
->
if ($word =~ /^!done/)
{
    $retval = 1;
}
imagine a reply like that:
=name=system!done
by nodeny
Sun May 03, 2009 11:38 am
Forum: Scripting
Topic: perl API client
Replies: 107
Views: 57340

Re: perl API client

sub read_len
{
 my ($len,$c,$bytes);
 $sock->recv($c,1);
 $c=ord($c);
 $bytes=$c<0x80? 0 : $c<0xC0? 1 : $c<0xE0? 2 : $c<0xF0? 3 : 4;
 $len=$c & (0xFF >> $bytes);
 $bytes or return $len;
 while ($bytes--)
 { 
    $sock->recv($c,1);
    $len=($len << 8) + ord($c);
 }
 return $len;
}
by nodeny
Sun May 03, 2009 4:27 am
Forum: Scripting
Topic: perl API client
Replies: 107
Views: 57340

Re: perl API client

I mean
elsif ($len < 0x10000000)
...
elsif ($len < 0x10000000)
2 Identical conditions
by nodeny
Sun May 03, 2009 4:22 am
Forum: Scripting
Topic: perl API client
Replies: 107
Views: 57340

Re: perl API client

cheesegrits did you tested len>=0x200000? I think print $sock chr(($len >> 8) & 0xFF); print $sock chr(($len >> 8) & 0xFF); print $sock chr(($len >> 8) & 0xFF); ... will print one value. Maybe you mean print $sock chr(($len >> 24) & 0xFF); print $sock chr(($len >> 16) & 0xFF); print $sock chr(($len ...