in reply to Help Changing use into require/import
Hello computergeek and welcome to the monastery and to the wonderful world of Perl!
You can also be interested into Module::Load::Conditional
PS also note that the folowing works:
perl -e " my $rc; BEGIN{ + $rc = eval{require Capture::Tiny; Capture::Tiny->import ('capture'); 1; } } if ($rc){ ($SpoolFile->[0],$CMDERR[0],$ReturnCode)=capture{sy +stem qq[ echo Hello, World | cat ]}; print join ', ', $ReturnCode, $SpoolFile->[0]; } " 0, Hello, World
Infact use is equivalent to BEGIN { require Module; Module->import( LIST ); } as per use docs.
PPS see also some other links about compile time / run time
L*
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Help Changing use into require/import
by stevieb (Canon) on Mar 07, 2018 at 21:54 UTC |
In Section
Seekers of Perl Wisdom