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

Re: [perl #948] $, untieable?

Thread Next
From:
Abigail
Date:
October 20, 2003 14:43
Subject:
Re: [perl #948] $, untieable?
Message ID:
20031020214255.GA26197@abigail.nl

[I tried sending this earlier today with the bugs.perl.com website, but
 it never showed up here, so I mail directly].

[coral - Sun Jul  6 15:54:50 2003]:

> [abigail <!--c--> <i>at</i> <!--a--> delanet.com - Thu Jul  1 12:09:24
1999]:
>
> > Why can I tie $", but I cannot tie $, ? Or am I missing something?
>
> This has been fixed as of bleadperl, @18374.  Thanks for the report!

Actually, it's only partially fixed. You can tie $, now, but it only
has effect if you access $, directly; not when when $, is accessed
indirectly when printing an array. This is different than the behaviour
of $" which tieable for both the direct and indirect access.

Again my original program:

#!/opt/perl/5.9.0/bin/perl -w

use strict;

$, = ","; # $, is undefined by default.

print "0: "; print qq {[$"] [$,]}; print "\n";

tie $", 'A';
tie $,, 'A';

sub A::TIESCALAR {bless \my $x, 'A'}
sub A::FETCH     {"<-->"}

my @a = ("") x 5;
print "1: "; print "@a"; print "\n";
print "2: "; print  @a;  print "\n";
print "3: "; print qq {[$"] [$,]}; print "\n";
__END__
Running this gives:

0: [ ] [,]
1: <--><--><--><-->
2: ,,,,
3: [<-->] [<-->]


We see here from the last line that if we access $" and $, directly,
the value is FETCHed. However, as the line with '2:' shows, the value
$, is not FETCHed when there's an indirect access to $, due to the
printing of @a. However, the indirect access to $" *is* FETCHed, as the
line with '1:' shows.

That was my original bugreport, and I don't think patch 18374 fixed it.


I don't think bug #948 has been resolved, and I think it should be
re-opened (I don't have the permission to change the status back to open).


Abigail

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