develooper Front page | perl.perl5.porters | Postings from February 2003

Re: odd (or not so odd?) segmentation fault in 5.8.0

Thread Previous | Thread Next
Enache Adrian
February 16, 2003 05:35
Re: odd (or not so odd?) segmentation fault in 5.8.0
Message ID:
On Thu, Feb 13, 2003 at 12:38:59AM -0500, Mark Mielke wrote:
> I haven't seen this reported yet. I'll try to track it down tomorrow,
> but in case anybody in the know can point out the problem immediately:
> $ perl -e 'sub TIESCALAR {bless[]} sub FETCH {*a=\1;1}
> > tie($a,__PACKAGE__); print $a'

You seem to assume that when you pointed the *a glob to 1, you
wipe all tie magic from the $a variable. This doesn't happen.

When you say print $a, Perl try to call the 1's svt_get()
magic callback :-( - since $a still is a tied, magic variable.

Better try to rewrite your code to something like this ?
perl -e 'sub TIESCALAR {bless[]} \
	 sub FETCH {my $a = tied $_[0]; untie $$a; $$a=1} \
	 tie($a,__PACKAGE__);print $a'


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About