</div>
<div class="slide">
+ <h1>Introduce Yourselves</h1>
+
+ <ul>
+ <li>Your name</li>
+ <li>What you do with Perl</li>
+ <li>Why you're here today (optional)</li>
+ </ul>
+</div>
+
+<div class="slide">
<h1>Moose Summed Up</h1>
<ul>
<ul>
<li>Delegate to <em>unblessed</em> Perl types</li>
<li>Scalar, array or hash ref, etc</li>
+ <li>Treat Perl types as objects</li>
+ <li>Still uses <code>handles</code></li>
+ <li>Pretend that native Perl types have methods</li>
</ul>
</div>
<div class="slide">
- <h1>Native Delegation - Array</h1>
+ <h1>Native Delegation - Array(Ref)</h1>
+
+ <ul>
+ <li>Methods include:
+ <ul>
+ <li><code>push</code></li>
+ <li><code>shift</code></li>
+ <li><code>elements</code> - returns all elements</li>
+ <li><code>count</code></li>
+ <li><code>is_empty</code></li>
+ <li>quite a few more</li>
+ </ul>
+ </li>
+ </ul>
+<div>
+
+<div class="slide">
+ <h1>Native Delegation - Array(Ref)</h1>
<pre><code>package Person;
use Moose;
</div>
<div class="slide">
- <h1>Native Delegation - Counter</h1>
+ <h1>Native Delegation - Array(Ref)</h1>
+
+ <pre><code>my $person = Person->new();
+
+$person->add_favorite_number(7);
+$person->add_favorite_number(42);
+
+print "$_\n"
+ for $person->favorite_numbers;
+
+# 7
+# 42</code></pre>
+</div>
+
+<div class="slide">
+ <h1>Native Delegation</h1>
- <pre><code>package Stack;
+ <ul>
+ <li>Native types are ...
+ <ul>
+ <li>Number - <code>add</code>, <code>mul</code>, ...</li>
+ <li>String - <code>append</code>, <code>chop</code>, ...</li>
+ <li>Counter - <code>inc</code>, <code>dec</code>, ...</li>
+ <li>Bool - <code>set</code>, <code>toggle</code>, ...</li>
+ <li>Hash - <code>get</code>, <code>set</code>, ...</li>
+ <li>Array - already saw it</li>
+ <li>Code - <code>execute</code>, that's it</li>
+ </ul>
+ </li>
+ </ul>
+</div>
+
+<div class="slide">
+ <h1>Curried Delegation</h1>
+
+ <ul>
+ <li>A delegation with some preset arguments</li>
+ <li>Works with object or Native delegation</li>
+ </ul>
+</div>
+
+<div class="slide">
+ <h1>Curried Delegation</h1>
+
+ <pre><code>package Person;
use Moose;
-has depth => (
- traits => [ 'Counter' ],
- is => 'ro',
- isa => 'Int',
- default => 0,
- init_arg => undef,
- <span class="highlight">handles =>
- { _inc_depth => 'inc',
- _dec_depth => 'dec',
- },</span>
+has account => (
+ is => 'ro',
+ isa => 'BankAccount',
+ handles => {
+ receive_100 =>
+ <span class="highlight">[ 'deposit', 100 ]</span>
+ give_100 =>
+ <span class="highlight">[ 'withdraw', 100 ]</span>
+ },</span>
);</code></pre>
</div>
-
<div class="slide">
<h1>Traits and Metaclasses</h1>