Skip Menu |
 

This queue is for tickets about the Tcl-pTk CPAN distribution.

Report information
The Basics
Id: 125826
Status: new
Priority: 0/
Queue: Tcl-pTk

People
Owner: Nobody in particular
Requestors: CAC [...] cpan.org
Cc:
AdminCc:

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



Subject: warning when setting textvariable to undef
Widgets such as Label which can be created with a textVariable. If the variable is cleared by assigning undef, then a warning like this will be printed:

Use of uninitialized value in subroutine entry at /opt/local/lib/perl5/vendor_perl/5.26/Tcl/pTk/demos/widget_lib/menus2.pl line 195.


I observed this in the widget demo program (menus2.pl); I also noticed that the menus.pl demo uses an empty string instead of undef to clear the Label, possibly as a workaround to prevent this warning. But for compatibility with Perl/Tk, and to go along with the more general convention that using undef as a string should be the same as using an empty string, this might be something to support. (Though I think assigning an empty string to clear the Label shows what the intention is more clearly.)

I'm not sure where this might be addressed, but I wonder if this is due to something in Tcl.xs (from Tcl.pm), since when using the debugger, there's nothing to step into right after the statements where undef is assigned; the warning shows up, and I'm already on the next line.

On Wed Jul 11 21:06:48 2018, CAC wrote:
I observed this in the widget demo program (menus2.pl); I also noticed that the menus.pl demo uses an empty string instead of undef to clear the Label, possibly as a workaround to prevent this warning.

I added the empty string workaround to menus2.pl in Tcl::pTk 0.93 as a workaround to prevent the warning.

I also opened a pull request with Perl/Tk to use empty string in menus.pl and menus2.pl for consistency, even though there does not appear to be any similar warning under Perl/Tk: https://github.com/eserte/perl-tk/pull/34


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.