Why is this dup failing under BSD?

Discussion in 'Perl Misc' started by Robert Nicholson, Dec 30, 2006.

  1. I've been doing the following in order to use flock ie. covert a file
    descriptor to a File Handle

    my %hash;
    my $hash = tie (%hash, 'DB_File', $listsDb, O_RDONLY|O_CREAT, 0644)
    or
    die "Cannot open $listsDb\n";

    my $fd = $hash->fd;
    open(DB_FH, "+<&=$fd") or die "dup $!";
    flock (DB_FH, LOCK_SH) or die "flock: $!";


    under BSD I get an error when I do this.

    Can anybody tell me why?
    Robert Nicholson, Dec 30, 2006
    #1
    1. Advertising

  2. Robert Nicholson wrote:
    > I've been doing the following in order to use flock ie. covert a file
    > descriptor to a File Handle
    >
    > my %hash;
    > my $hash = tie (%hash, 'DB_File', $listsDb, O_RDONLY|O_CREAT, 0644)
    > or
    > die "Cannot open $listsDb\n";
    >
    > my $fd = $hash->fd;
    > open(DB_FH, "+<&=$fd") or die "dup $!";
    > flock (DB_FH, LOCK_SH) or die "flock: $!";
    >
    >
    > under BSD I get an error when I do this.


    Patient: Doctor it hurts when I do this.

    Doctor: Well, don't do that.

    (is BSD always on top?)


    > Can anybody tell me why?


    My ESP tells me ... wait ... I see an error on line 42 ... no ... wait ...
    line 15 ... does "line 15" mean anything to you?




    John
    --
    Perl isn't a toolbox, but a small machine shop where you can special-order
    certain sorts of tools at low cost and in short order. -- Larry Wall
    John W. Krahn, Dec 30, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Elf M. Sternberg

    Python signal delivery under BSD 4.4

    Elf M. Sternberg, Aug 12, 2003, in forum: Python
    Replies:
    8
    Views:
    335
    Donn Cave
    Aug 16, 2003
  2. Mr. SweatyFinger
    Replies:
    2
    Views:
    1,739
    Smokey Grindel
    Dec 2, 2006
  3. Replies:
    2
    Views:
    376
  4. François Beausoleil

    :s.respond_to?(:dup) && :s.dup raises

    François Beausoleil, Apr 5, 2007, in forum: Ruby
    Replies:
    1
    Views:
    91
    Tim Hunter
    Apr 5, 2007
  5. Luka Stolyarov
    Replies:
    10
    Views:
    280
    Thomas Sondergaard
    Sep 11, 2010
Loading...

Share This Page