Subject: | Compile warning in the debugger |
When a module that uses Method::Signatures is loaded in the debugger,
AND it turns warnings on, there will be a "Useless use of a constant"
warning.
package Foo;
use warnings;
use Method::Signatures;
method foo() {
}
1;
$ perl -I ~/tmp -dwle 'use Foo'
Loading DB routines from perl5db.pl version 1.33
Editor support available.
Enter h or `h h' for help, or `man perldebug' for more help.
Useless use of a constant (undef) in void context at
/Users/schwern/tmp/Foo.pm line 8.
at /Users/schwern/tmp/Foo.pm line 8
require Foo.pm called at -e line 1
main::BEGIN() called at /Users/schwern/tmp/Foo.pm line 10
eval {...} called at /Users/schwern/tmp/Foo.pm line 10
main::(-e:1): 1
DB<1>
This may be because of a difference between the nextstate and dbstate
ops. It is definitely a consequence of using Devel::BeginLift. `perl
-MO=Concise -d Foo.pm` tells the story:
4 <@> leave[1 ref] vKP/REFC ->(end)
1 <0> enter ->2
2 <;> dbstate(Foo 1751 Foo.pm:8) v:*,&,{,$ ->3
- <0> null v ->3
3 <;> dbstate(Foo 1751 Foo.pm:10) v:*,&,{,$ ->4
- <0> ex-const v ->4
I believe Perl is warning about that null op created by BeginLift
tearing the code call out.