Skip Menu |

This queue is for tickets about the Attribute-Constant CPAN distribution.

Report information
The Basics
Id: 84395
Status: resolved
Priority: 0/
Queue: Attribute-Constant

People
Owner: Nobody in particular
Requestors: pauseblx [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.06
Fixed in: (no value)



Subject: bug for assign an object pointer to constant
this simple program: #!/usr/bin/perl use strict; use warnings; use Attribute::Constant; use Data::Dumper; package myclass; sub new { my ($class,%params)=@_; return bless \%params,$class}; package main; my $o=myclass->new(a => 1,b => 2); my $x:Constant($o); print Dumper($o,$x),"\n"; exit 0; The dump omitted for $o and $x are different ($x is undef)
This is not a bug of Attribute::Constant. It is rather perl's attribute systems' feature that invokes attributes BEFORE variable initialization. For that reason I recommend Data::Lock::dlock. And to make my point clear I have changed the distro name to Data-Lock. See https://github.com/dankogai/p5-data-lock/ For details. Dan the Maintainer Thereof On Tue Apr 02 20:11:53 2013, pauseblx@gmail.com wrote: Show quoted text
> this simple program: > #!/usr/bin/perl > use strict; > use warnings; > use Attribute::Constant; > use Data::Dumper; > package myclass; > sub new { my ($class,%params)=@_; return bless \%params,$class}; > package main; > my $o=myclass->new(a => 1,b => 2); > my $x:Constant($o); > print Dumper($o,$x),"\n"; > exit 0; > > The dump omitted for $o and $x are different ($x is undef)