Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Why is this dup failing under BSD?

Reply
Thread Tools

Why is this dup failing under BSD?

 
 
Robert Nicholson
Guest
Posts: n/a
 
      12-30-2006
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?

 
Reply With Quote
 
 
 
 
John W. Krahn
Guest
Posts: n/a
 
      12-30-2006
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Rubyzip - `dup': can't dup NilClass (TypeError) Luka Stolyarov Ruby 10 09-11-2010 12:13 PM
:s.respond_to?(:dup) && :s.dup raises Fran├žois Beausoleil Ruby 1 04-05-2007 05:55 PM
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger ASP .Net 2 12-02-2006 03:46 PM
Why do #dup and #clone behave differently with respect to instance methods Robert Klemme Ruby 5 05-18-2004 09:21 AM
dup remove - why/how does this work - NEWBIE jason@cyberpine.com Perl Misc 7 02-17-2004 04:52 AM



Advertisments