Catmandu::Paged : "illegal division by zero" when limit is 0
nicolasfranck opened this issue · comments
my $hits = Catmandu::Hits->new( start => 0, limit => 0, hits => [], total => 100 );
say $hits->page;
returns:
Runtime error: Illegal division by zero at /Users/njfranck/.plenv/versions/5.22.0/lib/perl5/site_perl/5.22.0/Catmandu/Paged.pm
This happens when you call $hits->page
or $hits->last_page
.
I can't reproduce this with the latest Catmandu (1.2013).
cf. https://github.com/LibreCat/Catmandu/blob/dev/lib/Catmandu/Paged.pm#L130
cf. https://github.com/LibreCat/Catmandu/blob/dev/lib/Catmandu/Paged.pm#L139
If you set limit to zero, then these lines should fail, not?
You're right, I only tried out your example, which doesn't die.
resolved in 604b5d9
@nics nice ;-)