Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^2: Open a file on a specific file descriptor?

by polettix (Vicar)
on Jan 02, 2008 at 10:25 UTC ( [id://659945]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    open my $fh, '<', '/dev/zero' or die "$!";
    
  2. or download this
    pipe my ($header_in, $header_out);
    pipe my ($body_in, $body_out);
    
  3. or download this
    use Fatal qw( close );
    
    close STDIN;
    close STDOUT;
    pipe my ($message_in, $message_out);
    
  4. or download this
    #!/usr/bin/perl
    use strict;
    ...
    header_out has descriptor 5
    body_in has descriptor 6
    body_out has descriptor 7
    
  5. or download this
       while (1) {
          open my $fh, '<', '/dev/zero' or die "open(): $!";
    ...
          die "file descriptor $n not available" if fileno($fh) > $n;
          push @fakes, $fh;
       } ## end while (1)
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://659945]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2024-04-18 22:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found