</div>
<div class="slide">
- <h1>Augment and Inner</h1>
-
- <ul>
- <li>Inverted <code>super</code></li>
- <li>From least- to most-specific</li>
- <li>Like Mason's autohandler feature</li>
- <li>Grandparent to parent to child</li>
- <li>Not allowed in roles</li>
- </ul>
-</div>
-
-<div class="slide">
- <h1>Augment and Inner</h1>
-
- <pre class="medium"><code>package Document;
-
-sub xml { '<doc>' . <span class="highlight">inner()</span> . '</doc>' }
-
-package Report;
-extends 'Document';
-<span class="highlight">augment xml</span> =>
- sub { my $self = shift;
- $self->title() . <span class="highlight">inner()</span> . $self->summary() };
-
-package TPSReport;
-extends 'Report';
-<span class="highlight">augment xml</span> =>
- sub { my $self = shift;
- $self->tps_xml() . <span class="highlight">inner()</span> };</code></pre>
-</div>
-
-<div class="slide">
- <h1>Augment and Inner</h1>
-
- <ul>
- <li>When we call <code>$tps->xml</code> ...
- <ul>
- <li><code>Document->xml</code></li>
- <li><code>Report->xml</code></li>
- <li><code>TPSReport->xml</code></li>
- </ul>
- </li>
- </ul>
-</div>
-
-<div class="slide">
- <h1>Augment and Inner Usage</h1>
-
- <ul>
- <li>Call <code>inner()</code> to "fill in the blank"</li>
- <li>Requires designing for subclassing</li>
- <li>Call <code>inner()</code> in the terminal class, just in case</li>
- </ul>
-</div>
-
-<div class="slide">
<h1>Method Modifiers Summary</h1>
<ul>
<li>alter parameters passed to the original method</li>
<li>alter the return value of the original method</li>
<li>not call the original method at all (or call a <em>different</em> method)</li>
+ <li>When using modifiers in a role, require the modified method</li>
</ul>
</li>
</ul>
</div>
<div class="slide">
- <h1>Method Modifiers Summary</h1>
-
- <ul>
- <li>When using modifiers in a role, require the modified method</li>
- <li>Use <code>augment</code> and <code>inner</code> to invert the normal subclassing flow ...
- <ul>
- <li>Least- to most-specific (parents to children)</li>
- <li>Build in "insertability" (stick more stuff in the "middle")</li>
- </ul>
- </li>
- <li>Always call <code>inner</code> in the most specific subclass to allow for future extension</li>
- </ul>
-</div>
-
-<div class="slide">
<h1>Questions?</h1>
</div>