Skip Menu |

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

Report information
The Basics
Id: 131589
Status: open
Priority: 0/
Queue: Tk-JBrowseEntry

People
Owner: Nobody in particular
Requestors: jeff.stephens [...] 4dcad.org.uk
Cc:
AdminCc:

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



Subject: Tk-JBrowseEntry version 5.23 - Warnings when running with "use Diagnostics"
Date: Tue, 17 Dec 2019 00:19:34 -0000
To: <bug-Tk-JBrowseEntry [...] rt.cpan.org>
From: "Jeff" <jeff.stephens [...] 4dcad.org.uk>
Hi I am using Perl 16.3 (in Windows 10) and Tk-JBrowseEntry v5.23, and I am getting a number of "Use of uninitialized value in numeric" warnings, when including the 'use Diagnostics' pragma. I have included a very simple Perl script as an example (see below). It seems that a number of the Tk-JBrowseEntry options e.g. -colorstate, -maxwidth, . etc. cause the warnings as they are assumed to be defined in the Tk-BrowseEntry.pm module. I initially thought that the issue was related to just a -state => 'readonly', but also get it with -state => 'normal'. The program will run happily - despite the warnings, so it is just annoying to see them as the program starts up. use strict; use warnings; use diagnostics; use Tk; use Tk::JBrowseEntry; my $MainWin = MainWindow->new; #SET UP SOME DEFAULT VALUES. my $dbname1 = 'cows'; my $dbname2 = 'pigs'; #HERE'S A NORMAL COMBO-BOX. my @list = qw(pigs cows foxes goats); my $jb1 = $MainWin->JBrowseEntry( -label => 'Readonly:', -variable => \$dbname1, -state => 'readonly', -choices => \@list, ); $jb1->pack( -side => 'top', -pady => 10, -anchor => 'w'); my $jb2 = $MainWin->JBrowseEntry( -label => 'Normal:', -variable => \$dbname2, -choices => \@list, ); $jb2->pack( -side => 'top', -pady => 10, -anchor => 'w'); MainLoop; I get the following when I run the simple Perl program (above) I get the following reported: Use of uninitialized value in numeric eq (==) at C:/Perl64/site/lib/Tk/JBrowseEntry.pm line 1036 (#1) (W uninitialized) An undefined value was used as if it were already defined. It was interpreted as a "" or a 0, but maybe it was a mistake. To suppress this warning assign a defined value to your variables. To help you figure out what was undefined, perl will try to tell you the name of the variable (if any) that was undefined. In some cases it cannot do this, so it also tells you what operation you used the undefined value in. Note, however, that perl optimizes your program anid the operation displayed in the warning may not necessarily appear literally in your program. For example, "that $foo" is usually optimized into "that " . $foo, and the warning will refer to the concatenation (.) operator, even though there is no . in your program. Use of uninitialized value in numeric gt (>) at C:/Perl64/site/lib/Tk/JBrowseEntry.pm line 2349 (#1) Use of uninitialized value in numeric ne (!=) at C:/Perl64/site/lib/Tk/JBrowseEntry.pm line 2361 (#1) Use of uninitialized value in numeric eq (==) at C:/Perl64/site/lib/Tk/JBrowseEntry.pm line 2554 (#1) Use of uninitialized value in numeric eq (==) at C:/Perl64/site/lib/Tk/JBrowseEntry.pm line 2555 (#1) Use of uninitialized value in numeric eq (==) at C:/Perl64/site/lib/Tk/JBrowseEntry.pm line 2562 (#1) Use of uninitialized value in pattern match (m//) at C:/Perl64/site/lib/Tk/JBrowseEntry.pm line 2566 (#1) Use of uninitialized value in numeric eq (==) at C:/Perl64/site/lib/Tk/JBrowseEntry.pm line 2582 (#1) Hope it's easy to resolve. Thanks in advance. Best regards Jeff Stephens

Message body is not shown because it is too large.

Unfortunately, this is NOT gonna be easy to resolve properly as most of these are option hash values (they are assumed to have a default of ''). Perl has become a real nanny a/b this stuff, but it will require alot of labor to catch 'em all and to add a ton of "if (defined(*))" tests to catch 'em all, and is therefore a low priority, as you can simply not use warnings if these msgs bother you, but yes, I'll pbly eventually get around to fixing them as I catch 'em, so leaving this bug open for now. PATCHES WELCOME though! ;-) Regards, Jim On Tue Jan 28 22:25:57 2020, jeff.stephens@4dcad.org.uk wrote: Show quoted text
> Hi > > > > I am using Perl 16.3 (in Windows 10) and Tk-JBrowseEntry v5.23, and I am > getting a number of "Use of uninitialized value in numeric" warnings, when > including the 'use Diagnostics' pragma. > > > > I have included a very simple Perl script as an example (see below). > > > > It seems that a number of the Tk-JBrowseEntry options e.g. -colorstate, > -maxwidth, . etc. cause the warnings as they are assumed to be defined in > the Tk-BrowseEntry.pm module. > > I initially thought that the issue was related to just a -state => > 'readonly', but also get it with -state => 'normal'. > > > > The program will run happily - despite the warnings, so it is just annoying > to see them as the program starts up. > > > > > > use strict; > > use warnings; > > use diagnostics; > > > > use Tk; > > use Tk::JBrowseEntry; > > my $MainWin = MainWindow->new; > > #SET UP SOME DEFAULT VALUES. > > my $dbname1 = 'cows'; > > my $dbname2 = 'pigs'; > > > > #HERE'S A NORMAL COMBO-BOX. > > my @list = qw(pigs cows foxes goats); > > my $jb1 = $MainWin->JBrowseEntry( > > -label => 'Readonly:', > > -variable => \$dbname1, > > -state => 'readonly', > > -choices => \@list, > > ); > > $jb1->pack( > > -side => 'top', -pady => 10, -anchor => 'w'); > > > > my $jb2 = $MainWin->JBrowseEntry( > > -label => 'Normal:', > > -variable => \$dbname2, > > -choices => \@list, > > ); > > $jb2->pack( > > -side => 'top', -pady => 10, -anchor => 'w'); > > MainLoop; > > > > > > I get the following when I run the simple Perl program (above) I get the > following reported: > > > > Use of uninitialized value in numeric eq (==) at > > C:/Perl64/site/lib/Tk/JBrowseEntry.pm line 1036 (#1) > > (W uninitialized) An undefined value was used as if it were already > > defined. It was interpreted as a "" or a 0, but maybe it was a mistake. > > To suppress this warning assign a defined value to your variables. > > > > To help you figure out what was undefined, perl will try to tell you > > the name of the variable (if any) that was undefined. In some cases > > it cannot do this, so it also tells you what operation you used the > > undefined value in. Note, however, that perl optimizes your program > > anid the operation displayed in the warning may not necessarily appear > > literally in your program. For example, "that $foo" is usually > > optimized into "that " . $foo, and the warning will refer to the > > concatenation (.) operator, even though there is no . in > > your program. > > > > Use of uninitialized value in numeric gt (>) at > > C:/Perl64/site/lib/Tk/JBrowseEntry.pm line 2349 (#1) > > Use of uninitialized value in numeric ne (!=) at > > C:/Perl64/site/lib/Tk/JBrowseEntry.pm line 2361 (#1) > > Use of uninitialized value in numeric eq (==) at > > C:/Perl64/site/lib/Tk/JBrowseEntry.pm line 2554 (#1) > > Use of uninitialized value in numeric eq (==) at > > C:/Perl64/site/lib/Tk/JBrowseEntry.pm line 2555 (#1) > > Use of uninitialized value in numeric eq (==) at > > C:/Perl64/site/lib/Tk/JBrowseEntry.pm line 2562 (#1) > > Use of uninitialized value in pattern match (m//) at > > C:/Perl64/site/lib/Tk/JBrowseEntry.pm line 2566 (#1) > > Use of uninitialized value in numeric eq (==) at > > C:/Perl64/site/lib/Tk/JBrowseEntry.pm line 2582 (#1) > > > > > > Hope it's easy to resolve. Thanks in advance. > > > > Best regards > > Jeff Stephens >