At 13:44 -0700 4/13/04, Steve Schein wrote:
Liz:

I put together some sample code below that generates the error to which
I've been referring using Perl 5.8.4RC1.  It should run fine on 5.8.0.
My output is:

The new filehandle is: *main::FH
The number of items in the active user's data array is/are: 2
1111
Can't upgrade that kind of scalar at 584error.pl line 25.

change the sub to read::


    open(my $handle, $path) || die $!;
    return $handle;

you get the more meaningful error message:

Invalid value for shared scalar at 1 line 16.

also in perl 5.8.0. The fact that it _looks_ like it works in 5.8.0 is that $foo{$rec}[1] contains the _string_ "*main::FH", which you can check by taking a ref of it.

I'm not sure whether there using a glob for file handle (by name) access across threads is not without danger. I think that's why it's not possible anymore from 5.8.1...


I'm afraid you will need to pass the file specification of the file to be opened to each thread, and then open a file handle inside that thread...




Liz

Reply via email to