X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=moose-class%2Fslides%2Findex.html;h=7c57d21d4ae1eb31a769326c0268e7b8beeac735;hb=cd02a58e2785ea5ff6ad393b916627181d3c5a5d;hp=7759fd3ed919f6f5594aad5db2d8e791d6080212;hpb=62e6bee07fceae46a1910ff3c663e794a08733c8;p=gitmo%2Fmoose-presentations.git
diff --git a/moose-class/slides/index.html b/moose-class/slides/index.html
index 7759fd3..7c57d21 100644
--- a/moose-class/slides/index.html
+++ b/moose-class/slides/index.html
@@ -71,7 +71,8 @@ img#me05 {top: 43px;left: 36px;}
- Declarative OO sugar
- Introspectable
- - Extensible (MooseX::* on CPAN)
+ - Extensible (177 MooseX::* on CPAN)
+ - Community approved (1222 downstream dependents on CPAN)
@@ -892,8 +893,8 @@ use Moose;
BUILDARGS
- - Takes
@_
, returns a hash reference of attribute name/value pairs
- - Accepts a hash or hashref; throws otherwise
+ - Processes
new
's @_
, returns a hash reference of attribute name/value pairs
+ - Accepts a hash or hashref; errors otherwise
- Provide your own for other cases
- Always call
$class->SUPER::BUILDARGS(@_)
as a fallback!
@@ -967,6 +968,7 @@ sub BUILD {
- Technically it's a hash reference
- If you ever treat it as one you are doing it wrong!
+ - Moose probably provides a feature to do what you need
@@ -976,6 +978,7 @@ sub BUILD {
- Like
DESTROY
, but Moose makes sure all DEMOLISH
methods in a hierarchy are called
- Called in normal inheritance order, children to parents
+ - Never called by you, only by Perl itself
@@ -1039,6 +1042,7 @@ extends 'LWP';
override
is another method modifier
- An alternative to Perl's
SUPER::
+ - Declares your intent to override a method
@@ -1050,13 +1054,13 @@ use Moose;
extends 'Person';
-override work => sub {
+override work => sub {
my $self = shift;
die "Pay me first"
unless $self->got_paid;
- super();
-};
+ super();
+};
@@ -1525,7 +1529,7 @@ use Moose;
with 'HasSize';
-has size => ( is => 'ro' );
+has size => ( is => 'ro' );
@@ -1539,7 +1543,7 @@ requires 'size';
package Shirt;
use Moose;
-has size => ( is => 'ro' );
+has size => ( is => 'ro' );
with 'HasSize';
@@ -1561,9 +1565,9 @@ with 'HasSize';
package Comparison;
use Moose;
-has [ 'left', 'right' ] => (
- is => 'ro',
- does => 'Comparable',
+has [ 'left', 'right' ] => (
+ is => 'ro',
+ does => 'Comparable',
);
@@ -1860,7 +1864,7 @@ has bank => (
sub _build_bank {
my $self = shift;
return Bank->new(
- name => 'Spire FCU' );
+ name => 'Spire FCU' );
}
@@ -1927,7 +1931,7 @@ has shoe_size => (
has shoes => (
is => 'ro',
lazy => 1,
- builder => '_build_shoes',
+ builder => '_build_shoes',
);
sub _build_shoes {
@@ -2000,7 +2004,7 @@ has account => (
package Person;
use Moose;
-has shoe_size => (
+has shoe_size => (
is => 'ro',
init_arg => 'foot_size',
);
@@ -2018,7 +2022,7 @@ print $person->shoe_size;
package Person;
use Moose;
-has shoes => (
+has shoes => (
is => 'ro',
init_arg => undef,
);
@@ -2584,15 +2588,12 @@ Item
Bool
True
- 1
-924.1
-'true'
-{}
+ 1
False
0
-0.0
'0'
+''
undef
@@ -2752,7 +2753,7 @@ duck_type Car => qw( run break_down );
Subtype Shortcuts - enum
use Moose::Util::TypeConstraints;
-enum Color => qw( red blue green ) );
+enum Color => qw( red blue green );
@@ -3018,9 +3019,9 @@ coerce ArrayOfInt
use MyApp::Types qw( ArrayOfInt );
-has transaction_history => (
- is => 'rw',
- isa => ArrayOfInt,
+has transaction_history => (
+ is => 'rw',
+ isa => ArrayOfInt,
);
@@ -3204,7 +3205,7 @@ $alice->friend($bob);
has lungs => (
is => 'ro',
- isa => 'Lungs',
+ isa => 'Lungs',
handles => [ 'inhale', 'exhale' ],
);
@@ -3535,10 +3536,6 @@ print Person->meta
-
Questions?
-
-
-
Exercises
# cd exercises
@@ -3549,28 +3546,17 @@ Iterate til this passes all its tests
-
Questions?
-
+ CYOA
-
-
The End
-
-
-
-
More Information
+
+ If there is time, keep going ...
+
-
+
+ Otherwise, jump to slide 269 ...
+
-
Bonus: A Brief Tour of MooseX
@@ -3580,7 +3566,7 @@ Iterate til this passes all its tests
- Not comprehensive
- - 152 MooseX distributions on CPAN as of 02/02/2010
+ - 177 MooseX distributions on CPAN as of 09/21/2010
- Some of them are crap
@@ -3762,8 +3748,43 @@ use Moose;
with HasCollection => { type => 'Int' };
+
+
Questions?
+
+
+
+
Moose-using Modules
+
+
+ For further reading, a few modules which use Moose ...
+
+
+
+
+
+
+
-
The End (Really)
+ The End