Re: PodViewer Problem

--- "Ratcliffe, Jeffrey (Peters)" <Jeffrey Ratcliffe External eads com> 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?


#!/usr/bin/perl -w

use strict;
use Gtk2 -init;
use Gtk2::Ex::PodViewer;
use Gtk2::Ex::Simple::List;

my $window = Gtk2::Window -> new;
$window -> signal_connect ( 'delete_event', sub { Gtk2 -> main_quit; } );

my $index = Gtk2::Ex::Simple::List->new('title' => 'text');
my $index_scrwin = Gtk2::ScrolledWindow->new;
$index_scrwin->set_policy('automatic', 'automatic');
$window -> add($index_scrwin);

my $viewer = Gtk2::Ex::PodViewer->new;

$viewer -> load($0);

map { push(@{$index->{data}}, [ $_ ]) } $viewer->get_marks;

$index->get_selection->signal_connect('changed', sub {
 my $idx = ($index->get_selected_indices)[0];
 my $mark = $index->{data}[$idx][0];
 return 1;

$window -> show_all;
Gtk2 -> main;


=head1 Name

=head1 Synopsis

=head1 Description

=head1 See Also

=head1 Author
gtk-perl-list mailing list
gtk-perl-list gnome org

I'd suggest to put

warn "\$mark=$mark";

just before


and see whether $mark is defined/imitialized.


I'm not sure why you're doing this:

map { push(@{$index->{data}}, [ $_ ]) } $viewer->get_marks;

- the "[ $_ ]" part means you creating anonymous arrays with only
one element in them, which is $_, and I do not see where you add elements
to these arrays, so do you really need the '[', ']' around '$_' ?

That is, do you really need these anonymous arrays ?


Applications From Scratch:

Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 

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