Problem with Storable on Windows



I'm trying to use Storable in conjunction with IPC::Open3 in order to
send complex data structures between the parent and child processes.
Unfortunately, although this seems to work a treat under Linux (Fedora
Core 4), it doesn't seem to work on Windows, returning the following
message:

Magic number checking on storable file failed at blib\lib\Storable.pm
(autosplit into blib\lib\auto\Storable\fd_retrieve.al) line 323, at
D:\Data\Perl\DBAsyncWorker.pl line 13

Here's my code:

Caller:

#!/usr/bin/perl

use Storable qw(nstore_fd freeze) ;
use IPC::Open3 ;
use IO::Handle ;

autoflush STDOUT ;
print "Caller starting\n" ;
$Storable::Deparse = 1 ;
%parms = ( data_source => 'DBI:Pg:dbname=matthew',
userid => 'matthew',
password => 'vishnu',
statement => 'select * from test_table') ;
$command = 'DBAsyncWorker.pl' ;
print "About to call worker\n" ;
$pid = open3($wtr,$rdr,$err,$command) ;
# This line added for Windows
binmode $wtr ;
print "Worker started\n" ;

while(($line = <$rdr>) !~ 'End') {
if ($line =~ /START/) {
print "Received start command\n" ;
nstore_fd \%parms, $wtr ;
}
else {
print $line ;
}
}


Worker:

#!/usr/bin/perl

use DBI ;
use Data::Dumper ;
use IO::Handle ;
use Storable qw(fd_retrieve thaw) ;

$Storable::Eval = 1 ;

autoflush STDOUT ;
# This line added for Windows
binmode STDIN ;
print "START\n";
$parm_ref = fd_retrieve(\*STDIN) ;
print "Retrieved parm reference\n",Dumper($parm_ref) ;
print "Userid = ",$parm_ref->{userid},"\n" ;
print "Password = ",$parm_ref->{password},"\n" ;
print "Statement = ",$parm_ref->{statement},"\n" ;
print "End\n" ;

Here's what I've tried, without luck:

* Using store_fd instead of nstore_fd
* Using freeze in the caller, printing the frozen value to $wtr, and
then reading it on the worker using sysread and using thaw

Freeze'ing and thaw'ing within a single program works fine, it's just
when I send it over a file handle that the problem occurs.

Does anybody have any ideas ?


.



Relevant Pages

  • IIS Auth Error - Kerberos/NTLM not accepting credentials
    ... I've got a Windows Server 2003 / IIS 6 machine running Windows SharePoint ... Caller User Name: - ...
    (microsoft.public.inetserver.iis.security)
  • Re: MagicJack
    ... installed mine on a Gateway with Windows XP and because I had ... I do have a few problems with the voice mail and caller ID and the ...
    (alt.home.repair)
  • Re: Faxing using phone line
    ... > Thank you for thte response John. ... >>>the Windows Fax Console for faxing. ... >>>Is there any way to configure the Windows Fax Console in Windows XP ... >>>the caller to press a certain key sequence if they want to fax? ...
    (microsoft.public.windowsxp.print_fax)
  • Wired problem
    ... I still have problem when Macintosh tries to access shared folder on Windows ... Logon Failure: ... Caller User Name: - ...
    (microsoft.public.windows.server.security)
  • Modal Dialogs on worker threads can cause exceptions in MFC with N
    ... I have an MFC application that puts up several message boxes on worker ... This has always worked when compiled with MFC 6.0. ... on Windows 2000 and Windows XP. ...
    (microsoft.public.win32.programmer.ui)