diff options
author | Louis Strous <louis.strous@gmail.com> | 2011-05-18 18:07:52 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2011-05-18 18:07:52 -0700 |
commit | 5332cc68bb11dca4e662c00cf52b0a57f28cf4a2 (patch) | |
tree | ebe4d9ea838d10d2b4b90e62465edab65b6e9cbc /lib/perl5db.pl | |
parent | 45025c0499bb4716fd6b7783de21f5ca691f36c8 (diff) | |
download | perl-5332cc68bb11dca4e662c00cf52b0a57f28cf4a2.tar.gz |
[perl #87740] perl debugger restart fails on Windows
Start debugger for some perl script, enter "R" command to restart.
Get no restart, but error message about POSIX macro _SC_OPEN_MAX and
termination of debugged program. Entering "R" again yields a similar
error message and terminates the debugger.
Lines 3332-3335 of perl5db.pl read:
>>
my $max_fd = 1024; # default if POSIX can't be loaded
if (eval { require POSIX }) {
$max_fd = POSIX::sysconf(POSIX::_SC_OPEN_MAX());
}
<<
POSIX Is available but POSIX::_SC_OPEN_MAX is not defined on Windows.
This yields an exception, which means that the "restart" code follow-
ing these lines is not executed, so no proper restart is done. If
POSIX weren't available at all, then a default value of 1024 would be
used for $max_fd.
A workaround is to not cause an exception if _SC_OPEN_MAX is not
defined, but instead use the default value that has already been
defined in case POSIX cannot be loaded at all. Do this by wrapping
line 3334 of perl5db.pl in an eval { }. Then on Windows the default
value of 1024 gets used for $max_fd, just like if POSIX were not
available at all. This seems to work OK for me on Windows 7. I can
now restart the debugger, and breakpoints are retained.
Diffstat (limited to 'lib/perl5db.pl')
-rw-r--r-- | lib/perl5db.pl | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/perl5db.pl b/lib/perl5db.pl index ea0d049a78..d237e00fb2 100644 --- a/lib/perl5db.pl +++ b/lib/perl5db.pl @@ -3319,7 +3319,7 @@ Return to any given position in the B<true>-history list my $max_fd = 1024; # default if POSIX can't be loaded if (eval { require POSIX }) { - $max_fd = POSIX::sysconf(POSIX::_SC_OPEN_MAX()); + eval { $max_fd = POSIX::sysconf(POSIX::_SC_OPEN_MAX()) }; } if (defined $max_fd) { |