From fb91f99efa822305f7bce849ccd1dfb2c5fe092c Mon Sep 17 00:00:00 2001
From: Niko Tyni <ntyni@debian.org>
Date: Sat, 23 Aug 2014 18:46:43 -0700
Subject: Tell the 'less' pager to allow terminal escape sequences

The 'ToTerm' backend generates terminal escape sequences that
the 'less' pager does not display by default. The "-R" option
controls this, so pass it in the LESS environment variable
to avoid disturbing other pager invocations.

Bug-Debian: https://bugs.debian.org/758689
Bug: https://rt.cpan.org/Public/Bug/Display.html?id=98636
Patch-Name: fixes/perldoc-less-R.diff
---
 cpan/Pod-Perldoc/lib/Pod/Perldoc.pm | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/cpan/Pod-Perldoc/lib/Pod/Perldoc.pm b/cpan/Pod-Perldoc/lib/Pod/Perldoc.pm
index 6ddd21d95d..1089f5bb3e 100644
--- a/cpan/Pod-Perldoc/lib/Pod/Perldoc.pm
+++ b/cpan/Pod-Perldoc/lib/Pod/Perldoc.pm
@@ -1892,6 +1892,9 @@ sub page {  # apply a pager to the output file
             if ($self->is_vms) {
                 last if system("$pager $output") == 0;
             } else {
+                # fix visible escape codes in ToTerm output
+                # https://bugs.debian.org/758689
+                local $ENV{LESS} = defined $ENV{LESS} ? "$ENV{LESS} -R" : "-R";
                 last if system("$pager \"$output\"") == 0;
             }
         }
