The stupid question is the question not asked | |
PerlMonks |
Re^3: XS: Manipulating refcountsby Animator (Hermit) |
on Sep 20, 2006 at 18:21 UTC ( [id://573968]=note: print w/replies, xml ) | Need Help?? |
Ofcourse there are (CORE) modules doing it... But it's not that because they do it you should do it too... And in my opinion the tied hash from DB_File and your scalar are two completly differnt things... The way to make DB_File segfault is to get the tied object and then change it. The way to make your code segfault is to either change the thing it references to or pass the wrong thing to one of your other routines. For example: This code will segfault. Sure in this example it is (or atleast should be) obvious why it segfaults... But if you are passing $artist to several subroutines and maybe forgetting it/passing the wrong thing once then it is not that obvious... To prevent $$artist from being changed you could use: SvREADONLY_on(SvRV(perlref));. But this still leaves the other issue... As in, passing the wrong variable/undef to new_cd(); (for example)... I guess it comes down to:
Update: removed accidental link.
In Section
Seekers of Perl Wisdom
|
|