
dalehend
stranger
Feb 1, 2001, 7:27 PM
Post #1 of 3
(2219 views)
|
error: explicit package name
|
Can't Post
|
|
I am trying to run a test script using a module HTML::Pager that has 'use strict'. It does not like the callback subroutine although it is declared The error msg with the script after: syntax error at testPager2.pl line 25, near "my " Global symbol "$get_data_sub" requires explicit package name at testPager2.pl line 25. Execution of testPager2.pl aborted due to compilation errors. #!/usr/bin/perl -w use HTML::Pager; use CGI; use strict; local $SIG{__WARN__} = \&Carp::cluck; my $pager; # my $get_data_sub; # get CGI query object my $query = CGI->new(); # create a callback subroutine to generate the data to be paged my $get_data_sub = sub { my ($offset, $rows) = @_; my @return_array; for (my $x = 0; $x < $rows; $x++) { push(@return_array, [ time() ]); } return \@return_array; } # create a Pager object my $pager = HTML::Pager->new( query => $query, get_data_callback => $get_data_sub, rows => 100, page_size => 10, debug => 1); # make it go - send the results to the browser. print $pager->output; RFQ Project Developer
|