in reply to 'require/use' scoping
There is one time when requireing a module will limit it's scope. When using threads:
C:\test>perl -Mthreads -wle"async{require CGI; print 'T:'.%{CGI::}}->detach; sleep 2; print ' +M:'.%{CGI::};" T:61/128 M:0
The above shows that a module required in a thread is not visible in other threads.
But if you use it anywhere, it will be visible (and consume space) in all threads:
C:\test>perl -Mthreads -wle"async{ use CGI; print 'T:'.%{CGI::} }->detach; sleep 2; print 'M: +'.%{CGI::};" T:62/128 M:62/128
|
|---|