Steve Hay <[EMAIL PROTECTED]> writes: >Hi, > >I''m writing a module, and have added "use warnings::register" to the >.pm file and now use "warnings::warnif()" throughout that file rather >than "use Carp;" ... "carp()". > >However, I also have some XS involved. All I can do in the XS is use >"warn()" (which does at least seem to behave like carp() rather than the >Perl-side warn()). > >Is there a way to do what warnings::warnif() does from XS?
This is a little tricky (by which I mean I have got it wrong several times ;-)) The snag being that your XS code is in a different "lexical scope" (Foo.xs) from the perl code that did the use warnings... and then again context is not fully set up for XSUB calls. Now XS code is C code and perl core is C code so XS can do _anything_ but it isn't necessarily easy. If you don't get more helpful help here then I suggest you re-ask on perl5-porters (possibly copy Paul Marquess who implemented this stuff). -- Nick Ing-Simmons http://www.ni-s.u-net.com/
