Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^2: pp: modules disappearing while program runs?

by pryrt (Abbot)
on Apr 07, 2022 at 13:17 UTC ( [id://11142796]=note: print w/replies, xml ) Need Help??


in reply to Re: pp: modules disappearing while program runs?
in thread pp: modules disappearing while program runs?

What if you delete the %INC entry (delete $INC{'Blah/Blah.pm'} for removing Blah::Blah) before the second require ... In my experiments (*), that allows me to have the require work again:

./lib/Blah/Blah.pm:

package Blah::Blah; use 5.012; # strict, // use warnings; $| = 1; print "Loading Blah::Blah at " . scalar(localtime) . "\n"; 1;

./example.pl:

#!perl use 5.012; # strict, // use warnings; use lib './lib'; $| = 1; require Blah::Blah; print "example separator\n"; delete $INC{'Blah/Blah.pm'}; print "entry deleted\n"; sleep(2); require Blah::Blah; print "example separator\n";

output:

Loading Blah::Blah at Thu Apr 7 06:17:19 2022 example separator entry deleted Loading Blah::Blah at Thu Apr 7 06:17:21 2022 example separator


Edit: add footnote: *: well, at the command line; I admit I didn't try in a pp executable

Replies are listed 'Best First'.
Re^3: pp: modules disappearing while program runs?
by choroba (Cardinal) on Apr 07, 2022 at 13:29 UTC
    Yes. Also the require happening in a child/thread.

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11142796]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2024-04-18 02:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found