Closed p5pRT closed 16 years ago
### In the file "Bill/Constants.pm"\, I have the following:
package Bill::Constants;
Readonly our $RETACT_DO_RETURN => 1; Readonly our $RETACT_DO_CANCEL => 2; Readonly our $RETACT_DO_MARK_FRAUD => 4; Readonly our $RETACT_DO_EMAIL_CONFIRM => 8; Readonly our $RETACT_EVERYTHING => $RETACT_DO_RETURN| $RETACT_DO_CANCEL|$RETACT_DO_MARK_FRAUD|$RETACT_DO_EMAIL_CONFIRM;
1;
### Then on the command line I do...
manchicken@thepea:\~/projects/billing$ perl -e 'use Devel::Peek;use Bill::Constants; print STDERR "$RETACT_EVERYTHING\n \n";Dump($RETACT_EVERYTHING);' && echo
### And here's my output ?
SV = PVMG(0x71ede0) at 0x620c30 REFCNT = 2 FLAGS = (GMG\,SMG\,RMG\,pPOK) IV = 0 NV = 0 PV = 0x621d80 "?"\0 CUR = 1 LEN = 8 MAGIC = 0x7207d0 MG_VIRTUAL = &PL_vtbl_packelem MG_TYPE = PERL_MAGIC_tiedscalar(q) MG_FLAGS = 0x02 REFCOUNTED MG_OBJ = 0x71f590 SV = RV(0x63fdd8) at 0x71f590 REFCNT = 1 FLAGS = (ROK) RV = 0x71f580 SV = PVMG(0x71eda8) at 0x71f580 REFCNT = 1 FLAGS = (PADBUSY\,PADMY\,OBJECT\,POK\,pPOK) IV = 0 NV = 0 PV = 0x7207b0 "?"\0 CUR = 1 LEN = 8 STASH = 0x681c60 "Readonly::Scalar"
### I have the following versions: $Readonly::XS::VERSION == 1.04 $Readonly::VERSION == 1.03
Attached is a copy of a simple script that also fails in the same manner (using much the same code)
On Mon\, 2008-04-28 at 18:01 -0700\, perlbug-followup@perl.org wrote:
#53482 -- Michael D. Stemle\, Jr. \manchicken@​manchicken\.com manchicken.com
First let's get this out of the way:
? = "1" | "2" | "4" | "8"\, \< = "4" | "8"\,
Meaning: if you see ? then it used strings and not the numbers.
First observation:
perl -wle 'my $x=4 ;my $y=8 ;print $x | $y;' # prints 12 perl -wle 'my $x="4";my $y="8";print $x | $y;' # prints \< perl -wle 'my $x="4";my $y="8";print 0 | $x | $y;' # prints 12
(which is ok/expected)
Second observation:
#!/usr/bin/perl -l
use Readonly;
Readonly my $RETACT_DO_MARK_FRAUD => 4; Readonly my $RETACT_DO_EMAIL_CONFIRM => 8; print $RETACT_DO_MARK_FRAUD|$RETACT_DO_EMAIL_CONFIRM; print $RETACT_DO_MARK_FRAUD|$RETACT_DO_EMAIL_CONFIRM; __END__
Output: \< 12
This shows that it first used the string "4" and the string "8" and
after that the number 4 and the number 8.
But I find this somewhat confusing...
perl -wle 'my $x="4";my $y="8";print $x | $y;print $x | $y' # prints
\< \< and not \< 12.
Looking deeper:
perl -wle 'use Tie::Scalar;use base qw/Tie::StdScalar/;tie my $x\,
"main"\, 4;tie my $y\, "main"\, 8;for (1 .. 2) { print $x | $y }'
Also prints \< and 12.
Taking Tie::Scalar out of the picture:
perl -wle 'sub TIESCALAR { my $foo = $_[1]; bless \$foo\, "main"; };sub
FETCH { ${ $_[0]} } ;tie my $x\, "main"\, 4;tie my $y\, "main"\, 8;for (1
.. 2) { print $x | $y }'
Also prints \< and 12.
So could this be a problem with how tie works?
Kind regards\,
Bram
The RT System itself - Status changed from 'new' to 'open'
$cat foo.pl
#!/usr/bin/perl -l
sub TIESCALAR { my $foo = $_[1]; bless \$foo\, "main"; };
sub FETCH { ${ $_[0]} }; tie my $x\, "main"\, 4; tie my $y\, "main"\, 8; for (1 .. 2) { print $x | $y }
perl588 foo.pl # \< and 12 perl5100 foo.pl # 12 and 12 perl-blead foo.pl # 12 and 12
So this was resolved in perl 5.10.
A workarround is to use Readonly our $RETACT_EVERYTHING => 0|$RETACT_DO_RETURN| $RETACT_DO_CANCEL|$RETACT_DO_MARK_FRAUD|$RETACT_DO_EMAIL_CONFIRM;
Kind regards\,
Bram
On Tue\, Apr 29\, 2008 at 01:29:24PM +0200\, Bram wrote:
$cat foo.pl
#!/usr/bin/perl -l
sub TIESCALAR { my $foo = $_[1]; bless \$foo\, "main"; };
sub FETCH { ${ $_[0]} }; tie my $x\, "main"\, 4; tie my $y\, "main"\, 8; for (1 .. 2) { print $x | $y }
perl588 foo.pl # \< and 12 perl5100 foo.pl # 12 and 12 perl-blead foo.pl # 12 and 12
So this was resolved in perl 5.10.
The upcoming 5.8.9 will have the same behaviour as 5.10. I don't know which source code change changed this behaviour.
Nicholas Clark
p5p@spam.wizbit.be - Status changed from 'open' to 'resolved'
I don't know which source code change changed this behaviour.
See patch 27633 which introduced a test marking that the READONLY
bug had been fixed\, but I counted tell which source code change had
fixed it.
Attached patch adds 3 tests to make sure the output stays the same.
Kind regards\,
Bram
From: Nicholas Clark [mailto:nick@flirble.org]On
The upcoming 5.8.9 will have the same behaviour as 5.10. I don't know which source code change changed this behaviour.
See patch 27633 which introduced a test marking that the READONLY bug had been fixed\, but I counted tell which source code change had fixed it.
Robin
This e-mail and any attachments may contain confidential and/or privileged material; it is for the intended addressee(s) only. If you are not a named addressee\, you must not use\, retain or disclose such information.
NPL Management Ltd cannot guarantee that the e-mail or any attachments are free from viruses.
NPL Management Ltd. Registered in England and Wales. No: 2937881 Registered Office: Serco House\, 16 Bartley Wood Business Park\, Hook\, Hampshire\, United Kingdom RG27 9UY
From: Robin Barker [mailto:Robin.Barker@npl.co.uk]
See patch 27633 which introduced a test marking that the READONLY bug had been fixed\, but I counted tell which source code change had fixed it. =====> couldn't
Robin
This e-mail and any attachments may contain confidential and/or privileged material; it is for the intended addressee(s) only. If you are not a named addressee\, you must not use\, retain or disclose such information.
NPL Management Ltd cannot guarantee that the e-mail or any attachments are free from viruses.
NPL Management Ltd. Registered in England and Wales. No: 2937881 Registered Office: Serco House\, 16 Bartley Wood Business Park\, Hook\, Hampshire\, United Kingdom RG27 9UY
From: Nicholas Clark [mailto:nick@flirble.org]On
The upcoming 5.8.9 will have the same behaviour as 5.10. I don't know which source code change changed this behaviour.
Perhaps change 26192. That was my guess when I submitted change 27633.
Robin
This e-mail and any attachments may contain confidential and/or privileged material; it is for the intended addressee(s) only. If you are not a named addressee\, you must not use\, retain or disclose such information.
NPL Management Ltd cannot guarantee that the e-mail or any attachments are free from viruses.
NPL Management Ltd. Registered in England and Wales. No: 2937881 Registered Office: Serco House\, 16 Bartley Wood Business Park\, Hook\, Hampshire\, United Kingdom RG27 9UY
On Tue\, 29 Apr 2008 16:54:24 +0100\, "Robin Barker" \Robin\.Barker@​npl\.co\.uk said:
> From: Nicholas Clark [mailto:nick@flirble.org]On
The upcoming 5.8.9 will have the same behaviour as 5.10. I don't know which source code change changed this behaviour.
> Perhaps change 26192. That was my guess when I submitted change 27633.
My binary search says 22074:
----Program---- #!/usr/bin/perl -l
sub TIESCALAR { my $foo = $_[1]; bless \$foo\, "main"; };
sub FETCH { ${ $_[0]} }; tie my $x\, "main"\, 4; tie my $y\, "main"\, 8; for (1 .. 2) { print $x | $y }
----Output of .../p7dcK3N/perl-5.9.0@22071/bin/perl---- \< 12
----EOF ($?='0')---- ----Output of .../pvpF9Iw/perl-5.9.0@22074/bin/perl---- 12 12
----EOF ($?='0')----
-- andreas
From: Andreas J. Koenig
My binary search says 22074
Looks like their are two bugs and two fixes
When does the following program give ":" not 10.
Thanks
Robin
----Program---- #!/usr/bin/perl -l
sub TIESCALAR { my $foo = $_[1]; bless \$foo\, "main"; };
sub FETCH { ${ $_[0]} }; tie my $x\, "main"\, 2; tie my $y\, "main"\, 8; print $x | $y;
This e-mail and any attachments may contain confidential and/or privileged material; it is for the intended addressee(s) only. If you are not a named addressee\, you must not use\, retain or disclose such information.
NPL Management Ltd cannot guarantee that the e-mail or any attachments are free from viruses.
NPL Management Ltd. Registered in England and Wales. No: 2937881 Registered Office: Serco House\, 16 Bartley Wood Business Park\, Hook\, Hampshire\, United Kingdom RG27 9UY
On Wed\, 30 Apr 2008 08:39:10 +0100\, "Robin Barker" \Robin\.Barker@​npl\.co\.uk said:
> From: Andreas J. Koenig
My binary search says 22074
> Looks like their are two bugs and two fixes
> When does the following program give ":" not 10.
Same thing.
----Program---- #!/usr/bin/perl -l
sub TIESCALAR { my $foo = $_[1]; bless \$foo\, "main"; };
sub FETCH { ${ $_[0]} }; tie my $x\, "main"\, 2; tie my $y\, "main"\, 8; print $x | $y;
----Output of .../p7dcK3N/perl-5.9.0@22071/bin/perl---- :
----EOF ($?='0')---- ----Output of .../pvpF9Iw/perl-5.9.0@22074/bin/perl---- 10
----EOF ($?='0')----
-- andreas
Thanks! This has been applied as change 7de9d14.
Steve Peters steve@fisharerojo.org
On Tue\, Apr 29\, 2008 at 8:00 AM\, Bram \p5p@​perl\.wizbit\.be wrote:
I don't know which source code change changed this behaviour.
See patch 27633 which introduced a test marking that the READONLY bug had been fixed\, but I counted tell which source code change had fixed it.
Attached patch adds 3 tests to make sure the output stays the same.
Kind regards\,
Bram
Migrated from rt.perl.org#53482 (status was 'resolved')
Searchable as RT53482$