X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=moose-class%2Fslides%2Findex.html;h=1a1d44f1b16823e9c319b1bfc3dfbf1a638d4ab2;hb=23d5de7494074a62e80a935962d87689efcb9a2f;hp=672f0553279e4a2c98f7c42d7aba4c64bf52b2d2;hpb=fc274492b82ec4f528c2799f97c97d68b47ed070;p=gitmo%2Fmoose-presentations.git diff --git a/moose-class/slides/index.html b/moose-class/slides/index.html index 672f055..1a1d44f 100644 --- a/moose-class/slides/index.html +++ b/moose-class/slides/index.html @@ -52,7 +52,7 @@ img#me05 {top: 43px;left: 36px;}

Introduction to Moose

-

git://git.moose.perl.org/moose-presentations.git

+

Dave Rolsky

@@ -218,7 +218,7 @@ use Moose;
@@ -300,8 +300,8 @@ has blog_uri => ( handles => { 'blog_host' => 'host' }, ); -$person->blog_host; -# really calls $person->blog_uri->host +$person->blog_host; +# really calls $person->blog_uri->host
@@ -955,7 +955,7 @@ sub BUILD {
  • Calls Person->BUILDARGS(@_) to turn @_ into a hashref
  • Blesses a reference
  • Populates attributes based on the hashref from #1
  • -
  • Calls $new_object->BUILDALL($constructor_args) +
  • Calls $new_object->BUILDALL($constructor_args)
    ... which calls all BUILD methods
  • Returns the object
  • @@ -1127,7 +1127,7 @@ print $person->first_name; # Dave use Moose; # true -Person->can('extends'); +Person->can('extends');
    + +
    +

    Cleaning Up Moose Droppings

    + +
    package Person;
    +use namespace::autoclean;
    +use Moose;
    +
    +...
     
     # false
    -Person->can('extends');
    +Person->can('extends');
    @@ -1163,13 +1176,13 @@ Person->can('extends');

    Immutability

    package Person;
     use Moose;
     
    -__PACKAGE__->meta->make_immutable;
    +__PACKAGE__->meta->make_immutable;
    @@ -1355,7 +1368,7 @@ sub print { # or ... -Person->meta->does('Printable') +Person->meta->does_role('Printable')
    @@ -1458,9 +1471,9 @@ use Moose; sub break { my $self = shift; - $self->break_it_down; + $self->break_it_down; if ( rand(1) < 0.5 ) { - $self->break_bone; + $self->break_bone; } } @@ -1495,7 +1508,7 @@ with 'Comparable'; sub is_equal { my $self = shift; - return $self->compare(@_) == 0; + return $self->compare(@_) == 0; } @@ -1510,8 +1523,8 @@ with 'TestsEquality'; # Satisfies the Comparable role sub compare { ... } -Integer->does('TestsEquality'); # true -Integer->does('Comparable'); # also true! +Integer->does('TestsEquality'); # true +Integer->does('Comparable'); # also true!
    @@ -1618,7 +1631,7 @@ has [ 'left', 'right' ] => (
    use Moose::Util qw( apply_all_roles );
     
    -my $fragile_person = Person->new( ... );
    +my $fragile_person = Person->new( ... );
     apply_all_roles( $fragile_person,
                      'IsFragile' );
    @@ -1774,8 +1787,8 @@ has first_name => ( required => 1, ); -Person->new( first_name => undef ); # ok -Person->new(); # kaboom +Person->new( first_name => undef ); # ok +Person->new(); # kaboom
    @@ -2045,11 +2058,11 @@ has shoe_size => ( init_arg => 'foot_size', ); -Person->new( shoe_size => 13 ); +Person->new( shoe_size => 13 ); my $person = - Person->new( foot_size => 13 ); -print $person->shoe_size; + Person->new( foot_size => 13 ); +print $person->shoe_size;
    @@ -2063,7 +2076,7 @@ has shoes => ( init_arg => undef, ); -Person->new( shoes => Shoes->new ); +Person->new( shoes => Shoes->new );
    @@ -2384,7 +2397,7 @@ after clear_password => sub { $self->$orig( $self->_munge_insert(@_) ); - $new_user->_assign_uri; + $new_user->_assign_uri; return $new_user; };
    @@ -3719,7 +3732,7 @@ sub run { ... } use App::CLI; -App::CLI->new_with_options()->run(); +App::CLI->new_with_options()->run();
    $ myapp-cli \
        --file foo \