develooper Front page | perl.perl5.porters | Postings from October 2001

Re: Clamp, wherefor art thou

Thread Previous | Thread Next
From:
Arthur Bergman
Date:
October 30, 2001 12:39
Subject:
Re: Clamp, wherefor art thou
Message ID:
04e201c1616d$c1cc3640$21000a0a@win32.local
> >You mean just croaking on a mg_store after SvREADONLY is on?
> 
> I meant that one could give the HV the required behaviour by a suitable
> struct mgvtbl - but perhaps delete hook isn't really in there.
> 

int shared_sv_store_mg (pTHX_ SV* sv, MAGIC *mg) {
    croak("Modification of readonly hash attempted");
}

MGVTBL svtable = { 0,
    MEMBER_TO_FPTR(readonly_hv),
    0,
    0,
    0
};

Maybe you could even peep on the stack to see what you tried to do and give a meaningfull error? Or allow delete.

:-)

> So we have the semantics defined for the existing SvREADONLY bit,
> we allow HE/Nullsv for allowed-but-not-existing.
> (I assume that delete $hash{'foo'} for a %hash with SvREADONLY
> leaves the HE and sets its SV * to Nullsv as proposed.)
> 

Or we add this to the core. It would be a rather small addition.

Arthur


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About