Skip Menu |

This queue is for tickets about the Tk-RadiobuttonGroup CPAN distribution.

Report information
The Basics
Id: 111794
Status: open
Priority: 0/
Queue: Tk-RadiobuttonGroup

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

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



Subject: Error using RadiobuttonGroup
Date: Fri, 5 Feb 2016 08:42:25 +0100
To: bug-Tk-RadiobuttonGroup [...] rt.cpan.org
From: Andreas Pawlak <andreas.pawlak [...] gmail.com>
Dear Maintainer, I am use Tk::RadiobuttonGroup (version 0.2.2) with perl 5.22.0. Thank you for this nice software. Irregularly, when creating the window containing the Group, perl (or Tk) throws the following error: Tk::Error: Can't set -list to `ARRAY(0x4042090)' for Tk::RadiobuttonGroup=HASH(0x4042540): ambiguous side "": must be top, bottom, left, or right []/perl5/perlbrew/perls/perl-5.22.0/lib/site_perl/5.22.0/x86_64-linux-thread-multi/Tk/Widget.pm line 1218. This does not happen always, but in a random fashion, i.e. sometimes the window is created correctly and sometimes not. I use RadiobuttonGroup with my $selected = 'device'; my @list = ('device', 'scaled'); my $radiobuttongroup = $wind->RadiobuttonGroup( -orientation => 'vertical', -list => \@list, -variable => \$selected )->pack(); As far as I could track the error back, the issue lies in the non-ordered way, the hash with the arguments is parsed. If -orientation is evaluated first, everything is fine, if -list is evaluated first, the error is thrown. I guess it lies in the undefined value of $self->{_orientation} in the second case. My workaround so far is changing lines RadiobuttonGroup to my $thing = undef; $self->{'_variable'} = \$thing; $self->{'_orientation'} = 'vertical'; # This line is added to provide the default value $self->{'_orientations'} = { horizontal => 'left', vertical => 'top' }; Maybe you can include this or a similar solution to the code. Thank you and best regards, Andreas Pawlak
On 2016-02-05 02:42:58, andreas.pawlak@gmail.com wrote: Show quoted text
> Dear Maintainer, > > I am use Tk::RadiobuttonGroup (version 0.2.2) with perl 5.22.0. Thank > you for this nice software. > > Irregularly, when creating the window containing the Group, perl (or > Tk) > throws the following error: > > Tk::Error: Can't set -list to `ARRAY(0x4042090)' for > Tk::RadiobuttonGroup=HASH(0x4042540): ambiguous side "": must be top, > bottom, left, or right > []/perl5/perlbrew/perls/perl-5.22.0/lib/site_perl/5.22.0/x86_64-linux- > thread-multi/Tk/Widget.pm > line 1218. > > This does not happen always, but in a random fashion, i.e. sometimes > the > window is created correctly and sometimes not. I use RadiobuttonGroup > with > > my $selected = 'device'; > my @list = ('device', 'scaled'); > my $radiobuttongroup = $wind->RadiobuttonGroup( > -orientation => 'vertical', > -list => \@list, > -variable => \$selected > )->pack(); > > As far as I could track the error back, the issue lies in the > non-ordered way, the hash with the arguments is parsed. If > -orientation > is evaluated first, everything is fine, if -list is evaluated first, > the > error is thrown. I guess it lies in the undefined value of > $self->{_orientation} in the second case. My workaround so far is > changing lines RadiobuttonGroup to > > my $thing = undef; > $self->{'_variable'} = \$thing; > $self->{'_orientation'} = 'vertical'; # This line is added to > provide the default value > $self->{'_orientations'} = { > horizontal => 'left', > vertical => 'top' > }; > > Maybe you can include this or a similar solution to the code.
This smells like a hash randomization problem, and thus affects only perls >= 5.17.6 The distribution's own test.pl always fails if PERL_HASH_SEED is set like this: $ env PERL_HASH_SEED=0 PERL_PERTURB_KEYS=NO perl5.18.4 -Mblib test.pl 1..13 # Running under perl version 5.018004 for freebsd # Current time local: Fri Feb 5 22:31:54 2016 # Current time GMT: Fri Feb 5 21:31:54 2016 # Using Test.pm version 1.26 ok 1 ok 2 ok 3 ok 4 not ok 5 # Test 5 got: "Can't set -list to `ARRAY(0x8026dda38)' for Tk::RadiobuttonGroup=HASH(0x804941b70): ambiguous side \"\": must be top, bottom, left, or right at /usr/perl5.18.4p/lib/site_perl/5.18.4/amd64-freebsd/Tk/Widget.pm line 1218.\n at /usr/perl5.18.4p/lib/site_perl/5.18.4/amd64-freebsd/Tk/Configure.pm line 45.\n at /usr/perl5.18.4p/lib/site_perl/5.18.4/amd64-freebsd/Tk/Derived.pm line 294.\n\n at /usr/perl5.18.4p/lib/site_perl/5.18.4/amd64-freebsd/Tk/Derived.pm line 306.\n" (test.pl at line 40) # Expected: "" (can't create RadiobuttonGroup widget) # test.pl line 40 is: ok($@, "", "can't create $class widget"); ok 6 # skip Can't set -list to `ARRAY(0x8026dda38)' for Tk::RadiobuttonGroup=HASH(0x804941b70): ambiguous side "": must be top, bottom, left, or right at /usr/perl5.18.4p/lib/site_perl/5.18.4/amd64-freebsd/Tk/Widget.pm line 1218. at /usr/perl5.18.4p/lib/site_perl/5.18.4/amd64-freebsd/Tk/Configure.pm line 45. at /usr/perl5.18.4p/lib/site_perl/5.18.4/amd64-freebsd/Tk/Derived.pm line 294. at /usr/perl5.18.4p/lib/site_perl/5.18.4/amd64-freebsd/Tk/Derived.pm line 306. ok 7 # skip ok 8 # skip ok 9 # skip ok 10 # skip ok 11 # skip ok 12 # skip On the other hand, it does not fail when setting PERL_HASH_SEED=5 and PERL_PERTURB_KEYS=NO: env PERL_HASH_SEED=5 PERL_PERTURB_KEYS=NO perl5.18.4 -Mblib test.pl So this is a possible workaround if you need something without changing the source code. As for a real fix: I think the code should be changed so that the configuration methods list, variable, and orientation should only "queue" their changes, and the actual changes are done in a callback fired by afterIdle. Tk::Table and Tk::Tile from the Perl/Tk distribution have some samples on this. Regards, Slaven