If anyone has any clue why it only works correctly with that "print top" statement
Quite frankly, if your code does indeed work correctly with that "print top" statement, then I'd just leave that statement there. Then, I'd contact the Magic Circle and show it to them because they'd probably pay you a big lump of cash once they work out how it "works", because they'll be able to use for as the basis of some damn good illusions.
If you add use strict: to the top of your program and fix all these errors:
C:\test>perl -c junk8.pl Global symbol "$q1" requires explicit package name at junk8.pl line 16 +. Global symbol "$q2" requires explicit package name at junk8.pl line 17 +. Global symbol "$q1" requires explicit package name at junk8.pl line 18 +. Global symbol "$q2" requires explicit package name at junk8.pl line 18 +. Global symbol "%sockOpened" requires explicit package name at junk8.pl + line 31. Global symbol "%sockOpened" requires explicit package name at junk8.pl + line 31. Global symbol "%sockOpened" requires explicit package name at junk8.pl + line 32. Global symbol "$q1" requires explicit package name at junk8.pl line 34 +. Global symbol "$q2" requires explicit package name at junk8.pl line 35 +. Global symbol "%sockOpened" requires explicit package name at junk8.pl + line 40. Global symbol "%sockOpened" requires explicit package name at junk8.pl + line 40. Global symbol "$bytes" requires explicit package name at junk8.pl line + 46. Global symbol "%sockOpened" requires explicit package name at junk8.pl + line 46. Global symbol "$bytes" requires explicit package name at junk8.pl line + 49. Global symbol "$bytes" requires explicit package name at junk8.pl line + 53. Global symbol "$port" requires explicit package name at junk8.pl line +63. Global symbol "$port" requires explicit package name at junk8.pl line +68. Global symbol "$port" requires explicit package name at junk8.pl line +68. Global symbol "$port" requires explicit package name at junk8.pl line +69. Global symbol "$sockNumConn" requires explicit package name at junk8.p +l line 87. Global symbol "$sockNumConn" requires explicit package name at junk8.p +l line 114. Global symbol "$time" requires explicit package name at junk8.pl line +133. Global symbol "$time" requires explicit package name at junk8.pl line +134. junk8.pl had compilation errors.
You might get close to understanding some of your problems. The entire logic of your code is dependant upon this hash %sockOpened. You use it to direct the flow of your program all over the place:
$sockOpened{$fn}->close() if defined($sockOpened{$fn}); ... if (!defined($sockOpened{$fn}) && !open($sockOpened{$fn}, ">&$ +fn")) { ... $bytes = syswrite($sockOpened{$fn}, "$count/n", length($count) ++1, 0);
But you never declare that variable, and you never write to it, so what is it that you are testing?
I also suspect my scripts could be somewhat more compresses but I guess I've always been in the habit of being more verbose so both myself and others could better understand what I'm doing...
Sorry, but it doesn't seem to be working for you.
In reply to Re^3: Sharing sockets between the main script and thread
by BrowserUk
in thread Sharing sockets between the main script and thread
by markseger
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |