|go ahead... be a heretic|
Iíve run into a strange little issue. Communicating with another piece of software (actually, Linphone), the command protocol is line based. To make sure there are no newlines in any of the commands, I decided to split and take the first (0th) element and just go with it, discarding the rest ó instead of using a regex to do it.
Later on, I figured Iíd allow more arguments to the method, joining them with spaces, so I can just pass a list when calling it (and so I donít have to concatenate variables into the command string all the time).
Long story short, hereís some code:
Calling it with things like $linphone->cmd("command"), $linphone->cmd("legacy command string I forgot to update\n") or $linphone->cmd("command", $argument1, $argument2) appears to work fine, as split shall return whatever is before the newline and all arguments are happy.
Calling it with $linphone->cmd('') however returns undef, which I feel is a very nasty thing for split to do.
Not sure if I actually have questions, this is probably a known caveat of split, but of course if thereís a way to coerce it to do the right thing, Iím all ears. Until then, I'll just // '' things or something like that.