Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Methods of Data::Page accept only scalars. #1

Closed
wants to merge 1 commit into from
Closed

Methods of Data::Page accept only scalars. #1

wants to merge 1 commit into from

Conversation

bessarabov
Copy link

This is a fix that prevent making mistake.

Here is the sample script:

my $total_entries = { a => 123 }; # <--- Here is the error! It should be number
my $entries_per_page = 10; 
my $current_page = 1;

my $page = Data::Page->new();
$page->total_entries($total_entries);
$page->entries_per_page($entries_per_page);
$page->current_page($current_page);

print "         First page: ", $page->first_page, "\n";
print "          Last page: ", $page->last_page, "\n";
print "First entry on page: ", $page->first, "\n";
print " Last entry on page: ", $page->last, "\n";

It prints something like this:

         First page: 1
          Last page: 652424
First entry on page: 1
 Last entry on page: 10

The problem is with the last page value.

PS This issue was originally discussed on http://play-perl.org/quest/51278657e8e8478d05000016

karenetheridge added a commit to karenetheridge/Data-Page that referenced this pull request Aug 16, 2019
karenetheridge added a commit to karenetheridge/Data-Page that referenced this pull request Aug 16, 2019
karenetheridge added a commit to karenetheridge/Data-Page that referenced this pull request Aug 16, 2019
karenetheridge added a commit to karenetheridge/Data-Page that referenced this pull request Aug 16, 2019
    - switch from Test::Exception to Test::Fatal
    - document that current_page must be a valid page number (RT#53475)
    - ensure that accessors only accept integers (GH acme#1)
    - various internal optimizations for speed
@karenetheridge
Copy link

This has been fixed in release 2.04 and can now be closed.

@bessarabov bessarabov closed this Aug 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants