in reply to Re^5: XML::Twig Support for Parameter Entities (do)
in thread XML::Twig Support for Parameter Entities
Yes, of course :-) do updates %INC, and a subsequent require will just return 1, telling that the file has already been loaded. This is actually a feature, it is a conditional do.
$ echo 13 > lucky.pl $ perl -l print do 'lucky.pl'; if (1 == require 'lucky.pl') { print "already loaded."; delete $INC{"lucky.pl"}; } print require 'lucky.pl'; print do 'lucky.pl'; __END__ 13 already loaded. 13 13
update: updated code with conditional block
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: XML::Twig Support for Parameter Entities (AAaD)
by tye (Sage) on Aug 13, 2015 at 07:37 UTC | |
by shmem (Chancellor) on Aug 13, 2015 at 08:23 UTC | |
by tye (Sage) on Aug 13, 2015 at 08:36 UTC | |
by shmem (Chancellor) on Aug 13, 2015 at 08:59 UTC |