in reply to Debugger, use strict, use warnings
Now, I know (through experimentation) that if I do: perl -wde 0 ...I've got the warnings.
Then you didn't do enough experimenting. ;)
But then your example surprised me because I had assumed that the debugger never gave me warnings for code entered at the command prompt.> perl -we "print 0+'abc'" Argument "abc" isn't numeric in addition (+) at -e line 1. 0 > perl -wde 0 DB<1> print 0+'abc' 0
So I experimented further and decided that you can get run-time warnings but not compile-time warnings for code entered at the debuger's command prompt.
But back to your real question...
The debuger runs your code using eval (how else?). So your example code ends up being closer to this:
and pragmas obey scope so it makes sense (to me, at least) that use warnings and use strict don't do much good in the above code.eval "use strict;"; eval "use warnings;"; eval "print undef;"; eval 'print $x[undef];';
I was going to suggest that you make a file e.pm:
so you could do:use strict; use warnings; 1
but that doesn't do any good.perl -de 0 DB<1> use e; print $x[undef]
But that reminds me! How do you make pragma magic creep up an extra level of scope? I know how to do this with modules that export symbols. Sometimes it'd be nice to do that with pragmas as well.
- tye (but my friends call me "Tye")
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re (tilly) 2: Debugger, use strict, use warnings
by tilly (Archbishop) on Apr 10, 2001 at 20:52 UTC | |
by tye (Sage) on Apr 10, 2001 at 21:26 UTC | |
by tilly (Archbishop) on Apr 10, 2001 at 22:16 UTC | |
by tye (Sage) on Apr 10, 2001 at 22:55 UTC | |
|
Re: (tye) Debugger, use strict, use warnings
by Coleoid (Sexton) on Apr 11, 2001 at 20:26 UTC | |
by tye (Sage) on Apr 11, 2001 at 20:54 UTC |