Setting $! in xs

Setting $! in xs

am 06.08.2011 11:15:59 von Beau Cox

--000325572c32890e7904a9d2a9e5
Content-Type: text/plain; charset=ISO-8859-1

Hi -

I am a bit confused about how to set $! from within an xs module. I have
searched perlxstut, perlxs, and perlguts without really understanding what
is involved. Can some one either point me to a module that sets $! or give
me a short description on how it is done?

Thanks!

--000325572c32890e7904a9d2a9e5--

Re: Setting $! in xs

am 06.08.2011 20:48:07 von Rob Dixon

On 06/08/2011 10:15, Beau E. Cox wrote:
> Hi -
>
> I am a bit confused about how to set $! from within an xs module. I have
> searched perlxstut, perlxs, and perlguts without really understanding what
> is involved. Can some one either point me to a module that sets $! or give
> me a short description on how it is done?

I have never written XS code to do this, but since perldoc perlvar says

> If used numerically, yields the current value of the C "errno"
> variable, or in other words, if a system or library call fails,
> it sets this variable.

I imagine that assigning to errno in your C code would do the trick.
Whether that also propagates to the contents of %! I cannot say.

Rob


--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/