Setting $! in xs

--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--
Beau Cox [ Sa, 06 August 2011 11:15 ] [ ID #2063062 ]

Re: Setting $! in xs

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 [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
Rob Dixon [ Sa, 06 August 2011 20:48 ] [ ID #2063065 ]
Perl » gmane.comp.lang.perl.beginners » Setting $! in xs

Vorheriges Thema: Using an undefined value as a hash reference
Nächstes Thema: Parsing a Text File using regex