<h1>BUILDARGS</h1>
<ul>
- <li>Takes <code>@_</code>, returns a hash reference of attribute name/value pairs</li>
- <li>Accepts a hash or hashref; throws otherwise</li>
+ <li>Processes <code>new</code>'s <code>@_</code>, returns a hash reference of attribute name/value pairs</li>
+ <li>Accepts a hash or hashref; errors otherwise</li>
<li>Provide your own for other cases</li>
<li><strong>Always</strong> call <code>$class->SUPER::BUILDARGS(@_)</code> as a fallback!</li>
</ul>
<ul>
<li>Technically it's a hash reference</li>
<li><span class="wrong">If you <em>ever</em> treat it as one <strong>you are doing it wrong!</strong></span></li>
+ <li>Moose probably provides a feature to do what you need</li>
</ul>
</div>
<span class="current incremental">extends 'Person';</span>
-<span class="incremental">override</span> work => sub {
+<span class="incremental">override</span> <span class="incremental">work</span> => sub {
my $self = shift;
die "Pay me first"
<h1>Roles in Practice</h1>
<ul>
- <li>Consuming a role =~ inlining the role</li>
+ <li>Consuming a role ≈ inlining the role</li>
</ul>
</div>
<li>Human <em>@ISA</em> Animal</li>
<li>Human <em>does</em> Toolmaker (as <em>does</em> Chimpanzee)</li>
<li>Car <em>@ISA</em> Vehicle</li>
- <li>Car <em>does</em> HasEngine</li>
+ <li>Car <em>does</em> Destroyable</li>
</ul>
</div>
</div>
<div class="slide">
- <h1>What if I Want to Share?</h1>
-
- <pre><code>package Person;
-use Moose;
-
-my $highlander_bank =
- Bank->new(
- name => 'Clan MacLeod Trust' );
-
-has bank => (
- is => 'rw',
- default => sub { $highlander_bank },
-);</code></pre>
-</div>
-
-<div class="slide">
<h1>Builder</h1>
<ul>
<ul>
<li>By default, subclasses inherit attribute as-is</li>
- <li>Can change some attribute parameters in subclasses
- <ul>
- <li>default</li>
- <li>builder</li>
- <li>required</li>
- <li>lazy</li>
- <li>others we've not yet covered</li>
- </ul>
- </li>
+ <li>Can change most attribute parameters in subclasses</li>
</ul>
</div>
<ul>
<li>An attribute's constructor name can be changed with <code>init_arg</code></li>
+ <li>Can set <code>init_arg</code> to <code>undef</code></li>
<li>A subclass can alter its parents' attributes</li>
- <li>Attribute accessor names can be changed</li>
+ <li>Accessor naming scheme can be changed</li>
</ul>
</div>
<h1>Bool</h1>
<h2>True</h2>
- <pre><code>1
-924.1
-'true'
-{}</code></pre>
+ <pre><code>1</code></pre>
<h2>False</h2>
<pre><code>0
-0.0
'0'
+''
undef</code></pre>
<ul>
<ul>
<li><strong>Not comprehensive</strong></li>
- <li>152 MooseX distributions on CPAN as of 02/02/2010</li>
+ <li>177 MooseX distributions on CPAN as of 09/21/2010</li>
<li>Some of them are crap</li>
</ul>
</div>
<li>mailing list - <a href="mailto:moose@perl.org">moose@perl.org</a></li>
<li>Slides and exercises are in Moose's git repo:
<br />
- <span style="font-size:80%; white-space: nowrap">git://jules.scsys.co.uk/gitmo/moose-presentations</span></li>
+ <span style="font-size:80%; white-space: nowrap">git://git.moose.perl.org/moose-presentations/moose.git</span></li>
</ul>
</div>