Maybe you need to explicitly ask for the response? That is, if the client doesn’t do that automatically, the actual add/set may not complete until you do.
“/system/script/add”, as well as “/system/script/set” both work on my RouterOS (6.2). I’m using my client, but I see no reason the Perl client would be any different.
Besides, have you tried doing the same on other menus? Does it work at least there?
Using the perl API for right this second, but basically what is happening is when I ask for the source it doesn’t seem to return from the function.
Does “/system/script/print” work via the API for you? That is what is hanging… anytime I request the source it seems to hang. My guess would be that the library isn’t handling newlines or something like that. But just verifying it works before I try to figure out what is wrong with the library.
a) either the API is returning “!do” after the end of the source… or
b) the library isn’t detecting the end of the stream because it is looking for “!done” but only sees “!do”.
Trying to use something like this
my(%scripts) = Mtik::get_by_key('/system/script/print,‘name’);
To get a list of all of the scripts and their contents… The problem is library is hanging on the request. Trying to debug it, but it seems like it isn’t getting the full final line… so it only sees “!do” instead of “!done” and thus just keeps trying to read from the socket.
in the other thread i already replied, this looks implementation specific. I used Python example, as it allows write commands on the fly and see the result as it is sent from the router.