in reply to Re^2: sysread() is deprecated on :utf8 handles
in thread sysread() is deprecated on :utf8 handles
Hello again mje,
Did you try the module that I recommend earlier?
Regarding your question The problem I am seeking an answer to is how to continue using sysread without getting the deprecated warnings I do not recommend that but you can read more here Supressing warnings.
Let us know what you have tried so far, provide us a sample of code to replicate the problem. We are just guessing for the moment.
Hope this helps, BR
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: sysread() is deprecated on :utf8 handles
by mje (Curate) on Jul 20, 2017 at 15:56 UTC | |
I did not try File::Slurper because I am not slurping a file, I'm reading data from a socket. I don't want to suppress the warning since it is warning of a deprecation which implies it will break in the future. There is a parent and a forked child process. The child creates a socket and starts listening for connections using IO::Select to see when the socket is read ready. The parent connects to the child's socket, sets encoding(UTF-8) and sends UTF-8 encoded XML down the socket to the child. The child sees the parents connect, accepts it enables encoding(UTF-8) on the new socket. When the child sees data, it reads it with sysread. There is a bit more to it than that but that is the essence of it.
The code is like (but not exactly) this
Results in
| [reply] [Watch: Dir/Any] [d/l] [select] |
by thanos1983 (Parson) on Jul 20, 2017 at 19:57 UTC | |
Hello mje, You can use read as a temporary solution it does not give the warning, but it is not the same as sysread. From the read documentation: The call is implemented in terms of either Perl's or your system's native fread(3) library function. To get a true read(2) system call, see sysread.I just tested with your code and the output looks ok:
In comparison with sysread:
Give it a try if it meets your criteria. I tested on:
Hope this helps, BR.
Seeking for Perl wisdom...on the process of learning...not there...yet!
| [reply] [Watch: Dir/Any] [d/l] [select] |