Community discussions

MikroTik App
 
200120022003
newbie
Topic Author
Posts: 25
Joined: Sat Jul 25, 2009 6:52 pm

How to get the return data with Perl API ?

Sun Jul 25, 2010 9:12 am

I have the code :
if (Mtik::login($mtik_host,$mtik_username,$mtik_password))
{
my %operands;
$operands{'numbers'} = '=stats';
my($retval,@results) = Mtik::mtik_cmd("/queue/simple/print", \%operands);
foreach (@results) {
  print "$_";
}
Mtik::logout;
}
Perl return :
HASH(0x84ddad0)
Can you help me ? Thank you !
 
200120022003
newbie
Topic Author
Posts: 25
Joined: Sat Jul 25, 2009 6:52 pm

Re: How to get the return data with Perl API ?

Sun Jul 25, 2010 10:26 am

I solved the problem refer to mtik_tty.pl.

Thank you !
if (Mtik::login($mtik_host,$mtik_username,$mtik_password))
{
my @cmd = ("/queue/simple/print", "=stats");
my($retval,@results) = Mtik::raw_talk(\@cmd);
foreach my $result (@results) {
print ">>> $result\n";
}
Mtik::logout;
}