Skip Menu |
Report information
Id: 127293
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: rob [at]

Severity: (no value)
Tag: (no value)
Platform: (no value)
Patch Status: (no value)
VM: (no value)

Subject: DOC INIT { use Module; } fails if Module is not installed, even if --doc is not used
Download (untitled) / with headers
text/plain 368b
For example: DOC INIT { use Pod::EOD; } If Pod::EOD is not installed, compilation of this code will fail, even if --doc is not used on the command line. On one hand, S26 implies that code inside of DOC INIT, DOC CHECK, and DOC BEGIN blocks is not executed if --doc is not used; on the other, use Module; statements are normally executed as soon as they're parsed.
Still present in Rakudo version 2016.07.1-88-g15ee3c3 built on MoarVM version 2016.07-11-g11e02fe
Download (untitled) / with headers
text/plain 904b
Without `--doc`, code inside a DOC block is not executed, but by necessity it still needs to be parsed. And `use` performs its magic at parse time, not at execution time. You could special-case DOC blocks so that any `use` statements (and other any compile-time things like phasers) that appear inside them, are ignored when `--doc` was not specified. But that comes with complications: 1) In case of a module, the precompilation system would have to store and manage two separate precompiled versions of the same file: One for `--doc`, and one without. Alternatively, `--doc` would have to bypass precompilation. 2) A Pod::* module wouldn't be able to export any symbols other than subroutines. If it exports any type names or operators, and the POD block code goes on to use those symbols, it would be a syntax error when run without `--doc` as the symbols wouldn't known to the parser in that case.

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

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at