unknown warning when setting scale length 
Author Message
 unknown warning when setting scale length

Environment: Perl 5.003/Tk 400.200, Sun SPARCstation, SunOS 4.1.4

I am a beginner with Perl/Tk.

Why does the following scale widget definition produce a warning about
the length option, even though the length is being set?

 my $vidscale = $main->Scale(
   -label => 'Video Quality',
   -variable => '::vidqual',
   -orient => 'horizontal',
    -fg => 'red',
    -length => '3i',
    -from => 0,
    -to => 100,
    -tickinterval => 20
    );

Perl Warning:
   Ambiguous use of length => resolved to "length" => at rate line 21.
--

               Networks Services & Interfaces Laboratory
                     Communications Research Centre
                        http://www.*-*-*.com/



Sun, 09 May 1999 03:00:00 GMT  
 unknown warning when setting scale length

: Environment: Perl 5.003/Tk 400.200, Sun SPARCstation, SunOS 4.1.4

: I am a beginner with Perl/Tk.

: Why does the following scale widget definition produce a warning about
: the length option, even though the length is being set?

:  my $vidscale = $main->Scale(
:    -label => 'Video Quality',
:    -variable => '::vidqual',
:    -orient => 'horizontal',
:     -fg => 'red',
:     -length => '3i',
:     -from => 0,
:     -to => 100,
:     -tickinterval => 20
:     );
:    
: Perl Warning:
:    Ambiguous use of length => resolved to "length" => at rate line 21.

length() is a Perl builtin function.  -length needs to be quoted here to avoid
the ambiguity.



Mon, 10 May 1999 03:00:00 GMT  
 unknown warning when setting scale length

: Why does the following scale widget definition produce a warning about
: the length option, even though the length is being set?

:  my $vidscale = $main->Scale(
:    -label => 'Video Quality',
:    -variable => '::vidqual',
:    -orient => 'horizontal',
:     -fg => 'red',
:     -length => '3i',
:     -from => 0,
:     -to => 100,
:     -tickinterval => 20
:     );
:    
: Perl Warning:
:    Ambiguous use of length => resolved to "length" => at rate line 21.

Because `length' is a reserved word in Perl -- remember, it gives you
the length of a string.  Luckily, Perl is doing the right thing here,
but to avoid the warning you should put quotes around "-length".  (Note
that you don't have to do it for the other parameters, since they're not
Perl reserved words.)

        Greg
--

Brain Imaging Centre (WB201)                 voice: (514) 398-4965 (or 1996)
Montreal Neurological Institute                fax: (514) 398-8948
Montreal, Quebec, Canada  H3A 2B4



Mon, 10 May 1999 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Scale widget not listening to -length ??

2. unpacking a string of unknown length?

3. Scale widget yelling warnings

4. scale - setting display without changing

5. Canvas->Scale and Tk::Scale conflict?

6. Problem with setting the Page Length

7. Perl tuning/speed question: all subsets of a set of length k -- keeping the inital order

8. Setting up a variable length format at runtime

9. backticks and setting a variable in $SIG{__WARN__}

10. perl: warning: Setting locale failed.

11. perl: warning: Setting locale failed

12. warning: setting locale failed (??) (5.004_04)

 

 
Powered by phpBB® Forum Software