Subject: | patch for hanging on Windows |
Version 0.02 hangs on Windows as stty is not available. Also ANSI sequences are not available on Windows, so use emulation module.
--
Alexandr Ciornii, http://chorny.net
Subject: | Makefile.PL.patch |
--- Makefile.PL.dist 2020-10-11 17:41:12.000000000 +0300
+++ Makefile.PL 2020-10-13 00:54:56.437500000 +0300
@@ -15,17 +15,20 @@
},
TEST_REQUIRES => {
'Test::More' => '0',
- 'IO::Handle' => '0',
- 'Term::ANSIColor' => '0',
},
PREREQ_PM => {
- #'ABC' => '1.6',
- #'Foo::Bar::Module' => '5.0401',
+ 'Term::ANSIColor' => '0',
+ 'IO::Handle' => '0',
},
dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
clean => { FILES => 'Term-ProgressSpinner-*' },
);
+if ($^O eq 'MSWin32') {
+ $WriteMakefileArgs{PREREQ_PM}{'Win32::Console'} = 0;
+ $WriteMakefileArgs{PREREQ_PM}{'Win32::Console::ANSI'} = '1.11';
+}
+
# Compatibility with old versions of ExtUtils::MakeMaker
unless (eval { ExtUtils::MakeMaker->VERSION('6.64'); 1 }) {
my $test_requires = delete $WriteMakefileArgs{TEST_REQUIRES} || {};
Subject: | ProgressSpinner.pm.patch |
--- ProgressSpinner.pm.dist 2020-10-12 14:43:23.000000000 +0300
+++ ProgressSpinner.pm 2020-10-12 21:14:11.595605800 +0300
@@ -1,6 +1,9 @@
package Term::ProgressSpinner;
our $VERSION = '0.02';
use 5.006; use strict; use warnings;
+if ($^O eq 'MSWin32') {
+ eval "use Win32::Console::ANSI;use Win32::Console;";
+}
use IO::Handle; use Term::ANSIColor; use Time::HiRes qw//;
our (%SPINNERS, %PROGRESS, %VALIDATE);
@@ -470,6 +473,11 @@
#TODO refactor everything to make context aware
sub savepos {
my $self = shift;
+ if ($^O eq 'MSWin32') {
+ my $CONSOLE = Win32::Console->new(Win32::Console::STD_OUTPUT_HANDLE());
+ my ($x) = $CONSOLE->Cursor();
+ $self->{savepos} = $x;
+ } else {
my $x='';
system "stty cbreak </dev/tty >/dev/tty 2>&1";
$self->output->print("\e[6n");
@@ -479,6 +487,7 @@
$self->clear();
$self->{savepos} = $n;
}
+}
sub loadpos {
my $self = shift;