Re: PodViewer Problem
- From: Sergei Steshenko <sergstesh yahoo com>
- To: "Ratcliffe, Jeffrey (Peters)" <Jeffrey Ratcliffe External eads com>, gtk-perl-list gnome org
- Subject: Re: PodViewer Problem
- Date: Thu, 14 Sep 2006 10:15:55 -0700 (PDT)
--- "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 PodViewer.pm line 312.
If I comment out the "$viewer->jump_to($mark);" line, the error goes away.
What have I got wrong?
Jeff
#!/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);
$index_scrwin->add_with_viewport($index);
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];
$viewer->jump_to($mark);
return 1;
});
$window -> show_all;
Gtk2 -> main;
__END__
=head1 Name
=head1 Synopsis
=head1 Description
=head1 See Also
=head1 Author
_______________________________________________
gtk-perl-list mailing list
gtk-perl-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list
I'd suggest to put
warn "\$mark=$mark";
just before
$viewer->jump_to($mark);
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 ?
--Sergei.
Applications From Scratch: http://appsfromscratch.berlios.de/
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]