… | |
… | |
110 | |
110 | |
111 | Example: |
111 | Example: |
112 | |
112 | |
113 | aio_open "/etc/passwd", O_RDONLY, 0, sub { |
113 | aio_open "/etc/passwd", O_RDONLY, 0, sub { |
114 | if ($_[0] >= 0) { |
114 | if ($_[0] >= 0) { |
115 | open my $fh, "<&$_[0]"; # create a copy for perl |
115 | open my $fh, "<&=$_[0]"; |
116 | aio_close $_[0], sub { }; # close the aio handle |
|
|
117 | print "open successful, fh is $fh\n"; |
116 | print "open successful, fh is $fh\n"; |
118 | ... |
117 | ... |
119 | } else { |
118 | } else { |
120 | die "open failed: $!\n"; |
119 | die "open failed: $!\n"; |
121 | } |
120 | } |