Branch: refs/heads/leonerd/newSVpviv Home: https://github.com/Perl/perl5 Commit: c9a797974662f18ba2c6b3bd56069df5f3846c3d https://github.com/Perl/perl5/commit/c9a797974662f18ba2c6b3bd56069df5f3846c3d Author: Paul "LeoNerd" Evans <leon...@leonerd.org.uk> Date: 2020-05-28 (Thu, 28 May 2020)
Changed paths: M MANIFEST M embed.fnc M embed.h M ext/XS-APItest/APItest.pm M ext/XS-APItest/APItest.xs A ext/XS-APItest/t/newSVpviv.t M handy.h M proto.h M sv.c Log Message: ----------- Add dualvar-creating newSVpviv and friends These two new functions and one macro create PV-and-IV dualvars, in similar style to the other newSV*() family. They are most convenient for wrapping error values from external libraries, to create dual number/string values in a similar style to core's $! wrapping of errno. For example: int err = uv_...(); if(err != 0) return newSVpviv(uv_strerr(err), err); This makes the usual style of error-type dualvar that can both be tested for numerical equality and additionally used as a string to yield its human-readable error message croak "Unable to complete: $err" unless $err == UV::UV_EAGAIN;