in reply to Interesting issue with DBD::AnyData?

I think you've been flock blocked.

The code is hanging trying to get an exclusive flock on the output filehandle (well, IO::File). I'm not entirely sure why this is so, but I am confused by this line at the top of AnyData::Storage::File:

use constant HAS_FLOCK => eval { flock STDOUT, 0; 1 };

Which to me looks like it would always return 1. If I remove the '1' from that definition, your program works, but that '1' is in all of the versions on CPAN, so I probably just don't understand constants flock. Of course, you'd never see this as a problem if your perl implementation supports flock ...

Updated: To expand on jZed's explanation, the flock fails fatally when flock is not supported. eval catches this and returns undef. I was mistakenly thinking it failed and continued. I flock-ed up.


The intelligent reader will judge for himself. Without examining the facts fully and fairly, there is no way of knowing whether vox populi is really vox dei, or merely vox asinorum. — Cyrus H. Gordon

Replies are listed 'Best First'.
Re^2: Interesting issue with DBD::AnyData?
by jZed (Prior) on Nov 17, 2005 at 20:52 UTC
    use constant HAS_FLOCK => eval { flock STDOUT, 0; 1 };
    
    If the flock fails, eval will return undef. If it succeeds, eval returns 1.

      Cool. Figured I wasn't understanding, thanks for the explanation. Still, the exclusive flock in open_local_file is where it is hanging, so I think there is something odd there.


      The intelligent reader will judge for himself. Without examining the facts fully and fairly, there is no way of knowing whether vox populi is really vox dei, or merely vox asinorum. — Cyrus H. Gordon
        Yes, I think you're right about flock being the problem. I think it may have been a change somewhere along the line in XML::Twig++ which AnyData uses. I'll investigate, or if you find something, patches welcome :-).