in reply to Perl 5.8.0 debugger annoyances

The pager functionality is fine in Perl 5.8.0 debug, and I tested.

What you need to do is to set environment variable PAGER from your OS/shell, before you start debug. It is too later, to set $ENV{PAGER} after you start your debug. That does not work.

Why? it is simple. There is a file called perl5db.pl in the lib directory, which determines the behavior of perl -d. Examine that file, you will find, perl reads in $ENV{PAGER} once after you start your debug, and then saved the value in a variable named $pager. After that, it just use the value stored in $pager, and never check ENV again. Now, it is clear.

Replies are listed 'Best First'.
Re: Re: Perl 5.8.0 debugger annoyances
by SIGSEGV (Sexton) on Dec 10, 2002 at 08:56 UTC
    Hi pg,

    gathering from your nick name, if not you who else should be familiar with the inards of pagers ;-)

    n.b. @ perlmonks' moderators, sorry for using the <pre> tag once again. When I logged in I just noticed for a second your request on my first posting here to refrain from using this tag. I'm afraid, I still will have to read your FAQs on formatting guidelines. I have been too impatient to reply to my post's responders, and didn't know for now how else to avoid the clutter.

    Now back to pg.
    Of course I felt that setting $ENV{PAGER} within the debug session was at a too late stage. That's why I already tried the shell's (i.e. HP-UX's standard shell which is a POSIX Bourne type) way of giving processes an environment by invocating the Perl debugger like this:

    $ PAGER=/usr/local/bin/less /usr/bin/perl -de ./my_buggy_script.pl
    (of course one could have also used the Unix "env" command)

    and I also tried the even better way (like you mentioned) of explicitly exporting PAGER:

    $ export PAGER=/usr/local/bin/less $ printenv PAGER /usr/local/bin/less $ perl -de my_buggy_script.pl
    Then in the debugger I did this:
    'time' => 1039509243 '/var/spool/sw' => HASH(0x4033aca0) 'basetype' => 'vxfs' 'bavail' => 262045 'bfree' => 279512 'blocks' => 512000 'bsize' => 8192 'favail' => 69876 'ffree' => 69876 'files' => 73740 'flag' => 0 'frsize' => 1024 'fsid' => 1073741834 'fstr' => '/var/spool/sw' 'namemax' => 255 'size' => 512000 'time' => 1037307204 DB<4> H 3: x \%mnt 2: |x \%mnt 1: o pager? DB<4> !1 o pager? pager = '|/usr/local/bin/less' DB<5>
    n.b. the hash %mnt is a lol with mount points as keys and as values the results of statvfs syscalls on these as a hashref (retrieved through the wonderful Filesys::Statvfs CPAN module).

    By the debugger history above I just wanted to show that "|x \%mnt" fails (i.e. displays nothing), whereas "x \%mnt" scrolls over the screen (I only copied the last key's value here).

    This only happens with my Perl builds of "new" releases > 5.6.0 On the boxes where I still have Perl <= 5.6.0 the debugger works as expected, and honours preset PAGER settings.

    Looks to me as if there is a bug in the Perl port for HP-UX 11.X 64Bit.

    Btw, have you tried to build a Perl 5.8.X on HP-UX (in case you have access to this platform)? Maybe the Configure routine is broken for this platform. I can tell you how long I struggled to get DBD::Oracle working on this platform. Maybe I miss some library, patch, or the linking was insufficient after Configure and make (e.g. PIC etc.)

    Would be nice to here from someone who uses the Perl debugger on HP-UX if they encounter similar strangenesses.

    Anyway, many thanks for pointing me to the involved Perl code.

    Edit by tye (replace PRE with formatting)