Howdy peeps, this was originally going to be a private email to module author tye, but alas the address in my copy of Win32API::File is outdated. And perhaps the wider Perl community can help/learn from this.
I have used Win32API::File to get
out of a few tight spots in the last couple years. Alas I have now
gotten into a spot that it should help me with, but I am coming up
short. I'm unable to set the HANDLE_FLAG_PROTECT_FROM_CLOSE flag and I'm not
sure if it is a problem with the module, or with my environment.
Here's sample code:
use Win32API::File qw(:Func :HANDLE_FLAG_);
open my $fh,">&2";
my $os_handle=GetOsFHandle($fh) or die "Can't GetOSFHandle: $^E,\nstop
GetHandleInformation($os_handle, my $flags);
print "flags was=$flags\n";
$flags |= HANDLE_FLAG_INHERIT|HANDLE_FLAG_PROTECT_FROM_CLOSE;
print "Trying for flags=$flags\n";
SetHandleInformation($os_handle, $flags, $flags) or die "Can't
GetHandleInformation($os_handle, my $newflags);
print "flags now=$newflags\n";
Trying for flags=3
It's the last line "flags now=1" that indicates to me that
SetHandleInformation isn't actually setting
This is perl 5, version 14, subversion 2 (v5.14.2) built for
(with 1 registered patch, see perl -V for more detail)
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
Outside of code tags, you may need to use entities for some characters:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||