diff options
Diffstat (limited to 'gmi.pl')
-rwxr-xr-x | gmi.pl | 24 |
1 files changed, 15 insertions, 9 deletions
@@ -686,16 +686,22 @@ sub display { $wrapper->columns($wc); } if ($use_pager) { - IO::Pager::open(my $FH) or warn($!); - for (@doc) { - _pre_block($_); - if ($pre_block) { - print $FH $_; - } - else { - print $FH $wrapper->wrap($_); + ### opening IO Pager + eval { + # catch it or big files ( >1000 lines ) will load but the script itself dies for some reason + local $SIG{PIPE} = sub { die }; + IO::Pager::open(my $FH) or warn($!); + for (@doc) { + _pre_block($_); + if ($pre_block) { + print $FH $_; + } + else { + print $FH $wrapper->wrap($_); + } } - } + close $FH; + }; } else { for (@doc) { |