in reply to Re^3: Threads and LWP::UserAgent question
in thread Threads and LWP::UserAgent question
If you do care, read on.
When you use global variables, they are created in the package scope, and copied for each created thread. If you use my inside your threaded function, the memory for that variable will only be allocated as needed, and only after spawning a new thread.
That being said, I do think your program isn't very clear about what which variable is global and which is not, and it would benefit the readability (and ease of debug) to declare each and every variable, either with my (lexical, sometimes called "local" in other languages) or with our (global), and use strict; to enforce that.
You also might take a look at Threads::Queue, which could be a replacement for your @queue variable.
|
|---|