Tassilo Parseval <[EMAIL PROTECTED]> writes:
>
>I was once more thinking about this PUSHMARK/PUSHBACK issue. perlapi.pod
>described them as "opening" and "closing" brackets for the arguments. If
>I leave those off altogether, shouldn't then simply the current @_ be
>passed on to the callback? This would be extremely handy in my case
>since the arguments for the callback are exactly those of the XSUB
>originally called. Therefore, I shouldn't need to re-populate @_ (at
>least not in theory).

But that is not how it works ;-)

Which is not to say you can't re-use caller's args - but you need
to do a PUSHMARK because XSUB (or perl) is going to pop one.

I think something like

    PUSHMARK(ORIGMARK);

would do what you need. 

You can also add G_NOARGS to flags of the call_sv() but if I recall correctly
that isn't a good idea if calling an XSUB (can't remember why...)
See L<perlcall>

>
>It worked like this for the callback that did not modify $_[0], 

No it didn't - you just did not notice the damage ...

>but not
>properly for the other one.


>
>> >2) Calling call_xxx() without G_EVAL often doesn't work correctly when
>> >your Perl sub can die().  Maybe it is just cargo cult, but I've been
>> >bitten by this one too many times and now always specify G_EVAL and check
>> >SvTRUE(ERRSV) myself to handle exceptions myself.
>> 
>> This has (I think) finally been fixed - but only recently.
>> Stick with the cargo-cult for portability.
>
>Ok, I take your word on that and change things accordingly. Tests with
>5.8.1, 5.6.1 and 5.00503 suggested that they all behave identical, but
>those weren't very complicated callbacks that I used.

You only see the problem if the callback "dies".

>
>Tassilo

Reply via email to