[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]
Re: A common base exception object for Perl - RFC
Pete Jordan <pjordan1@email.mot.com> writes:
>Nick Ing-Simmons wrote:
>
>> If C code just does what it does now all the way down to the
>> hunk(s) that do(es) the longjmp() to actually "thow" the exception
>> then we can just convert the string at that point into an object.
>> Sounds very do-able
>
>Yeah, that should be straightforward once I've sussed out how to create
>an object in C.
SV *MakeObject(SV *raw, char *class)
{
SV *sv = newRV_noinc(raw); /* typically you don't want to inc refcount */
HV *stash = gv_stashpv(class, TRUE); /* Find stash for class name */
return sv_bless(sv, stash); /* bless raw into class via new RV */
}
>What I was thinking about was providing a call to allow
>XS programmers to raise a non-default exception. Syntax really, given
>C's limitations.
Yes passing desired class down through the croak/die/... chain
would be a pain. And given the fact it is going to die the
way I usually do it (re-bless on return) is a non-starter.
So we would need a new API which had extra "desired class" args.
>
>Pete
--
Nick Ing-Simmons <nik@tiuk.ti.com>
Via, but not speaking for: Texas Instruments Ltd.
- Follow-Ups from:
-
Pete Jordan <pjordan1@email.mot.com>
- References to:
-
"Redford, John" <John.Redford@fmr.com>
Pete Jordan <pjordan1@email.mot.com>
Stephen Zander <gibreel@pobox.com>
Pete Jordan <pjordan1@email.mot.com>
Nick Ing-Simmons <nick@ing-simmons.net>
Pete Jordan <pjordan1@email.mot.com>
[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]