Re: PodViewer Problem

On Sep 14, 2006, at 10:45 AM, Ratcliffe, Jeffrey (Peters) wrote:

When running the attached program, I get the following error:

Use of uninitialized value in subroutine entry at line 312.

If I comment out the "$viewer->jump_to($mark);" line, the error goes away.

What have I got wrong?

Nothing.  It's a bug in PodViewer.  (Hi, Gavin!)

Line 312 of (version 0.16) is

        return $self->scroll_to_mark($mark, undef, 1, 0, 0);

According to the manpage for Gtk2::TextView, the signature is

$text_view->scroll_to_mark ($mark, $within_margin, $use_align, $xalign, $yalign)

           * $mark (Gtk2::TextMark)
           * $within_margin (double)
           * $use_align (boolean)
           * $xalign (double)
           * $yalign (double)

so that line should actually be

        return $self->scroll_to_mark($mark, 0, 1, 0, 0);

The XS code complains when it gets undef for something that should be a floating point number. It functions correctly, because the coercion of undef to a double is zero, but results in that annoying warning.

This naturally lead to a proliferation of code that was so complex that you had to put a drip pan under your computer to catch the pieces as the compiler melted down.
  - Pete Becker, on C++ templates

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]