New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Debugger stops on use
statement
#15642
Comments
From @KES777Created by @KES777When we enclose this code into braces: $ cat t3.pl { The debugger stops on use warnings 'void' statement: main::(/home/kes/tmp/t3.pl:4): use warnings 'void'; Perl Info
|
From @jkeenanOn Mon, 03 Oct 2016 07:41:49 GMT, kes-kes@yandex.ru wrote:
Here is my understanding of the situation. In 'perldoc -f use', we find this discussion of how 'use' is used for pragmata such as 'warnings': ##### use constant; Some of these pseudo-modules import semantics into the current block scope (like "strict" or "integer", unlike ordinary modules, which import symbols into the current package (which are effective through the end of the file). I understand this to mean: "If I put a 'use MODULE;' statement within a block, it will be effective past the end of the block up to the end of the file. The result will be the same as if I had not put the 'use MODULE;' statement within a block." I can confirm this understanding with these two programs: ##### use List::Compare; my $lc = List::Compare->new( __END__ { __END__ But I further understand the 'use' documentation to mean: "Unlike 'use MODULE;', 'use PRAGMA LIST;' only imports semantics into the block in which that 'use' statement appears. Once that block is closed, the pragma's semantics no longer apply. I can confirm this understanding with the following two programs, which behave different from one another with respect to warnings: ##### use warnings 'void'; print "Finished\n"; $ perl 129794-debugger-no-block.pl { $one, $two = 1, 2; print "Finished\n"; $ perl 129794-debugger-block.pl So in 129794-debugger-block.pl, "use warnings 'void';" is found within a block. If we therefore infer that this statement now qualifies as a run-time executable statement, we satisfy this language from 'perldoc perldebug': ##### However, the following language, also from 'perldoc perldebug', muddies the waters: ##### If you have compile-time executable statements (such as code within BEGIN, UNITCHECK and CHECK blocks or "use" statements), these will not be stopped by debugger, although "require"s and INIT blocks will, and compile-time statements can be traced with the "AutoTrace" option set in "PERLDB_OPTS"). Most of the time, we don't put 'use' statements into blocks, so we tend to think of them as being "compile-time". And we also tend to think of 'perl -d' as doing its "compile-time" work, as it were, "up front". However, given the differences between 'use MODULE' and 'use PRAGMA' with respect to blocks, it makes more sense to think of '{ use PRAGMA; }' as being a runtime executable statement on which the debugger would stop for the user to enter a command. Comments? Suggestions for documentation improvements? Thank you very much. -- |
The RT System itself - Status changed from 'new' to 'open' |
Migrated from rt.perl.org#129794 (status was 'open')
Searchable as RT129794$
The text was updated successfully, but these errors were encountered: