Dancer::Plugin::PageHistory::PageSet - collection of pages with accessors



For all methods that expect an argument type then this default_type will be the one used when type is not specified. Defaults to default.


In the event that "latest_page" or "previous_page" have no page to return then "fallback_page" is returned instead.

By default this is set to undef.

You can set this page to something else by passing any of the following as the value of this attribute:

  • a hash reference to be passed to Dancer::Plugin::PageHistory::Page->new

  • a Dancer::Plugin::PageHistory::Page object


The maximum number of each history type stored in "pages".


A hash reference of arrays of hash references.

Primary key is the history type such as default or product. For each type an array reference of pages is stored with new pages added at the start of the array reference.


An array reference of extra method names that should be added to the class. For example if one of these method names is 'product' then the following shortcut method will be added:

    sub product {
        return shift->pages->{"product"};


add( %args )

$args{type} defaults to "default_type".

In addition to type other arguments should be those passed to new in Dancer::Plugin::PageHistory::Page.


Predicate on "pages".

page_index($index, $type)

Returns the page from "pages" of type $type at position $index. If $type is not supplied then "default_type" will be used. If page is not found then "fallback_page" is returned instead.


A convenience method equivalent to:

    page_index(0, $type)


A convenience method equivalent to:

    page_index(1, $type)


Return all of the page types currently stored in history.

In array context returns an array of type names (keys of "pages") and in scalar context returns the same as an array reference.