in reply to Is it possible load optional modules from PERL5OPT?

You can specify an arbitrary block on the command line with a Maori farewell like this:

perl -M'5;BEGIN{eval{require Internal::Module}}'

It is a little bit tricky to embed this in PERL5OPT but maybe it is something you are looking for.

$ PERL5OPT="-M5;BEGIN{eval{require(Internal::Module)}}" perl -MO=Depar +se -e0 sub BEGIN { require 5; () } sub BEGIN { eval { do { require Internal::Module } }; } '???'; -e syntax OK

Greetings,
🐻

$gryYup$d0ylprbpriprrYpkJl2xyl~rzg??P~5lp2hyl0p$

Replies are listed 'Best First'.
Re^2: Is it possible load optional modules from PERL5OPT?
by Anonymous Monk on Aug 17, 2025 at 11:18 UTC
    Thank you, this is exactly what I was looking for!