Acme-CPANModulesBundle-Import-PerlDancerAdvent-2018

 view release on metacpan or  search on metacpan

devdata/http_advent.perldancer.org_2018_15  view on Meta::CPAN

<div class="pod-document"><h1><a name="dancer2__plugin__paginator___born_again"></a>Dancer2::Plugin::Paginator - Born Again</h1>

<h2><a name="history"></a>HISTORY</h2>

<p>I would call it re-birth. It all started during end of July 2017, I was going through the documentation of <a href="https://metacpan.org/pod/distribution/Dancer2/lib/Dancer2/Plugins.pod">Dancer2::Plugins</a> and stumbled upon <a href="https://meta...
<h2><a name="rebirth"></a>REBIRTH</h2>

<p>Following the <a href="http://neilb.org/2014/01/31/adoption-request.html">advise</a> from Neil Bowers, I contacted the author <b>Blabos de Blebe</b> by email, if he was happy for me take it forward. He not only encouraged me but also gave me permi...
<h2><a name="challenge"></a>CHALLENGE</h2>

<p>After getting the push from the author, my first challenge was to make it compatible with <a href="https://metacpan.org/pod/distribution/Dancer2/lib/Dancer2/Plugins.pod">Dancer2::Plugins</a>. Having done this with other plugins e.g. <a href="https...
<h2><a name="example"></a>EXAMPLE</h2>

<p>Let me show you an example as described in the official document for <a href="https://metacpan.org/release/Dancer2-Plugin-Paginator">Dancer2::Plugin::Paginator</a>.</p>
<pre class="prettyprint">use Dancer2;
use Dancer2::Plugin::Paginator;

get '/list' =&gt; sub {
    my $paginator = paginator(
       'curr'     =&gt; $page,
       'items'    =&gt; rset('Post')-&gt;count,

devdata/http_advent.perldancer.org_2018_15  view on Meta::CPAN

       next_l    =&gt; $paginator-&gt;next,
     };
}</pre>

<h3><a name="template"></a>Template</h3>

<pre class="prettyprint">&lt;% IF results.size %&gt;
   &lt;ul&gt;
      &lt;% FOREACH book IN results %&gt;
         &lt;% IF book.name %&gt;
            &lt;li&gt;&lt;b&gt;&lt;% book.name %&gt;&lt;/b&gt; &amp;nbsp; &lt;a href="/edit/book/&lt;% book.id %&gt;"&gt;Edit&lt;/a&gt;&lt;/li&gt;
         &lt;% END %&gt;
      &lt;% END %&gt;
   &lt;/ul&gt;
   &lt;br/&gt;
   &lt;hr/&gt;
   &lt;a href="/books/&lt;% prev_l %&gt;"&gt;[prev]&lt;/a&gt;...&lt;a href="/books/&lt;% next_l %&gt;"&gt;[next]&lt;/a&gt;
   &lt;hr/&gt;
&lt;% ELSE %&gt;
   &lt;ul&gt;&lt;li&gt;&lt;b&gt;No book found.&lt;/b&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;% END %&gt;</pre>



( run in 0.413 second using v1.01-cache-2.11-cpan-de7293f3b23 )