On Wed, Feb 19, 2020 at 02:46:51PM -0700, Philip Prindeville wrote: > Hi, > > I have some build scripts that used to work in perl-5.10 and when we updated to perl-5.16 one in particular broke badly. > > It does a: > > require $config_file; > > and two observations: (1) if $config_file is an absolute path, it no longer finds the file (I can see from a security standpoint that not being able to include arbitrary files anywhere on the system might be good…), tony@mars:.../git/perl$ cat ~/play/require.pl print "Hello\n"; 1; tony@mars:.../git/perl$ perl -e '$cfg = "/home/tony/play/require.pl"; require $cfg' Hello tony@mars:.../git/perl$ perl -v This is perl 5, version 28, subversion 1 (v5.28.1) built for x86_64-linux-gnu-thread-multi ... Do you have a more complete example? > and (2) if I change that too “… || die …” then the die doesn’t happen. > > Were there changes along the way to how “require” behaves? And what’s the workaround? It seems like require isn't failing in your example, or perl thinks the module is already loaded, for example: # the second require succeeds without loading $ perl -e '$cfg = "/home/tony/play/require.pl"; require $cfg; require $cfg;' Hello Perl sets $INC{supplied name} to indicate the file is already loaded, and if the previous load was successful, require will succeed without trying to reload the file. If you clear that entry the second load happens: tony@mars:.../git/perl$ perl -e '$cfg = "/home/tony/play/require.pl"; require $cfg; delete $INC{$cfg}; require $cfg;' Hello Hello This isn't new behaviour: tony@mars:.../git/perl$ ~/perl/5.10.0-debug/bin/perl -e '$cfg = "/home/tony/play/require.pl"; require $cfg; require $cfg;' Hello tony@mars:.../git/perl$ ~/perl/5.8.9-thr/bin/perl -e '$cfg = "/home/tony/play/require.pl"; require $cfg; require $cfg;' Hello If you want to unconditionally load a file you probably want "do": $ perl -e '$cfg = "/home/tony/play/require.pl"; do $cfg; do $cfg;' Hello Hello TonyThread Previous | Thread Next