in reply to Re^3: Count byte/character occurrence (quickly)
in thread Count byte/character occurrence (quickly)
when I try to use mce_open with $mem_file, I get an error:my $arg = shift; my $len = -s $arg; open my $file, '<', $arg; binmode $file; read $file, my $buf, $len; close $file; open my $mem_file, '<', \$buf; binmode $mem_file; .....do stuff....
open error: Invalid argument at C:/Perl/site/lib/MCE/Shared/Server.pm +line 1035 thread 1, <__ANONIO__> line 6. MCE::Shared::Server::__ANON__() called at C:/Perl/site/lib/MCE +/Shared/Server.pm line 1324 thread 1 MCE::Shared::Server::_loop(0, 6624) called at C:/Perl/site/lib +/MCE/Shared/Server.pm line 335 thread 1 eval {...} called at C:/Perl/site/lib/MCE/Shared/Server.pm lin +e 335 thread 1
Is there anyway I can get this to work? Because I have passed around this $mem_file in my script and would like to use it instead of having to re-read the actual file. If i need to elaborate any more please let me know :)
EDIT: I will go ahead and elaborate a little more. when I pass $mem_file to the sub and try to open it like this:
stat_check($mem_file); sub stat_check{ my ($mem_file) = @_; my $fh = MCE::Shared->handle( "<:raw", \$mem_file ); ....rest of threaded function... }
I get error:
Not a GLOB reference at C:/Perl/site/lib/MCE/Shared/Server.pm line 203 +6, <__ANONIO__> line 3.
If i try:
stat_check($mem_file); sub stat_check{ my ($mem_file) = @_; my $fh = MCE::Shared->handle( "<:raw", $mem_file ); ....rest of threaded function... }
I get error:
open error: Invalid argument at C:/Perl/site/lib/MCE/Shared/Server.pm +line 1035 thread 1, <__ANONIO__> line 6. MCE::Shared::Server::__ANON__() called at C:/Perl/site/lib/MCE +/Shared/Server.pm line 1324 thread 1 MCE::Shared::Server::_loop(0, 3232) called at C:/Perl/site/lib +/MCE/Shared/Server.pm line 335 thread 1 eval {...} called at C:/Perl/site/lib/MCE/Shared/Server.pm lin +e 335 thread 1
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Count byte/character occurrence (quickly)
by marioroy (Prior) on Apr 05, 2016 at 07:57 UTC | |
by james28909 (Deacon) on Apr 05, 2016 at 12:26 UTC |