I don't know about better, it really all depends on how you're passing around
zs and if/where it's being read in other parts of your code. If I was going to
do this, I would either implement the reading in straight C or use
PerlIO_read (
) if portability is desired. And I know it's just a snippet but
the one thing I would not do is return a -1 to the calling perl function - an undef
is more idiomatic (&PL_sv_undef).