in reply to Re: "use VERSION does not load the feature.pm, strict.pm, or warnings.pm"
in thread "use VERSION does not load the feature.pm, strict.pm, or warnings.pm"

Great explanations. Yes, I was confused about the difference between "load strict.pm file" and "enable strictures".

But once I actually went over strict.pm, I found another rabbit hole of multiple $^H "bits". So I checked which stricture bits are enabled by "use VERSION" vs "use strict". As it turns out, both set $^H = 256.

In fact, I'm not really sure how to set anything other than 256 (I've tried "use strict; no strict refs" etc), so this begs the further question of whether those strict tags actually work as advertised.

would save 0.0001 seconds of startup
Right. Depends on the device I guess; and now that I think about it, also on whether perl was actually installed with its core modules (e.g. libperl might have been statically linked into an app, but that's a whole different can of worms). Good to know.
  • Comment on Re^2: "use VERSION does not load the feature.pm, strict.pm, or warnings.pm"

Replies are listed 'Best First'.
The nature of $^H
by hv (Prior) on Apr 30, 2024 at 17:33 UTC

    The public-facing docs for this are in $^H; take careful note of the warning in the first paragraph.

    The names and meanings of the values are available internally from grep 'define \+HINT' perl.h, starting around line 5939 at the time of writing. However you will normally see the values described there only during compilation time, since that is when they're supposed to take effect. Thus:

    % perl -we 'use strict; BEGIN { printf "%#x\n", $^H }' 0x7e2 %

    .. i.e. strict is enabled (STRICT_VARS, STRICT_SUBS, STRICT_REFS), it was enabled by an explicit use strict (EXPLICIT_STRICT_VARS etc), and I'm guessing BLOCK_SCOPE just means we're in a block (the BEGIN block).

Re^3: "use VERSION does not load the feature.pm, strict.pm, or warnings.pm"
by NERDVANA (Priest) on Apr 30, 2024 at 17:31 UTC
    I'm kind of rusty on the $^H details myself, so it might turn out that some other magic variable does more of the work these days. But yeah, the point is just that strict is nothing more than flags set in the interpreter during the compile phase of a file, and there are several ways to accomplish it.