When I use this module in a script, the if ( $size_changed ) {
remains false when I've changed the terminal size.
When I copy the code from the module directly in a script (so that I don't have to load the module) it works as expected.
What could it be that loading the code as a module doesn't work?
use warnings;
use 5.014;
package My_Package;
use Exporter 'import';
our @EXPORT = qw(choose);
my $size_changed;
$SIG{WINCH} = sub { $size_changed = 1; };
sub choose {
# ...
# ...
while ( 1 ) {
my $c = getch();
if ( $size_changed ) {
write_screen();
$size_changed = 0;
next;
}
# ...
# ...
}
}