#645 Lexical pragma imports

open
nobody
Outline (28)
5
2012-05-02
2012-05-02
abhishekisnot
No

use strict and warnings are lexically scoped and dont have any package level effects. So, a code block like

use strict;
use warnings;
package MyPackage;

is same as:

package MyPackage;
use strict;
use warnings;

For the outline view, we should display these pragmas under package namespace (as opposed to 'main' namespace) in both the cases.

Discussion

  • abhishekisnot
    abhishekisnot
    2012-05-02

    maybe since these pragmas should be displayed under separate category (called Pragmata - padre does this.).

     
  • Jan Ploski
    Jan Ploski
    2012-05-03

    You are technically right about the lexical scoping, but I suspect that most authors' intent is for these pragmas to be actually package-scope. When you write them right under "package" there is a background thinking going on that when the package is eventually migrated to a standalone file, these pragmas should come along with it.

    Anyway, there is little benefit of displaying them under each package in the Outline, so if a change helps your development, feel free to submit a patch. Maybe they should not be displayed altogether? After all, you can disable warnings in a block and it is not displayed in the Outline in any way (nor should it be, I think).