package Person;
+use Moose;
+
+use namespace::clean -except => "meta";
+
+has [qw(first_name last_name)] => (
+ is => "rw",
+ required => 1,
+);
+
+sub full_name {
+ my $self = shift;
+ $self->first_name . " " . $self->last_name;
+}
+
+override BUILDARGS => sub {
+ my ( $self, @args ) = @_;
+
+ if ( @args == 1 and ref $args[0] eq 'ARRAY' ) {
+ my %p; @p{qw(first_name last_name)} = @{ $args[0] };
+ return \%p;
+ } else {
+ return super;
+ }
+};
+
+__PACKAGE__->meta->make_immutable;
1;
<div class="slide">
<h1>Introduction to Moose</h1>
- <h2>YAPC 2009</h2>
+ <h2>OSCON 2009</h2>
+ <h2><a href="git://git.moose.perl.org/moose-presentations.git"><tt>git://git.moose.perl.org/moose-presentations.git</tt></a></h2>
</div>
<div class="slide">
</div>
<div class="slide">
- <h1>The Object is Oqaque</h1>
+ <h1>The Object is Opaque</h1>
<ul>
<li>Technically it's a hash reference</li>
<ul>
<li><code>no Moose</code> at the end of a package is a best practice</li>
+ <li>Or <code>namespace::clean</code> at the top</li>
<li>Just do it</li>
</ul>
</div>