X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=moose-class%2Fslides%2Findex.html;h=e3814b78837583319bfb14b980b4d1a9edde0993;hb=3258951f22a6aed1774ec682fe4ad1365e154405;hp=ef009bea744bcaa529d32c40aa33eb74f18b4c14;hpb=9a42f64539e40c158f6f92ab6e7545cf4e9b04a0;p=gitmo%2Fmoose-presentations.git diff --git a/moose-class/slides/index.html b/moose-class/slides/index.html index ef009be..e3814b7 100644 --- a/moose-class/slides/index.html +++ b/moose-class/slides/index.html @@ -950,10 +950,10 @@ sub BUILD {
@@ -1155,8 +1155,8 @@ Person->can('extends');package Person;
-use namespace::autoclean;
use Moose;
+use namespace::autoclean;
...
@@ -1234,8 +1234,6 @@ use Moose;
# perl bin/prove -lv t/00-prereq.t
-# perl install-moose (if needed)
-
## Read the instructions in t/01-classes.t
# perl bin/prove -lv t/01-classes.t
@@ -1487,19 +1485,13 @@ Integer->does('Comparable'); # also true!
@@ -2400,9 +2392,9 @@ around run => sub {
class_type
use Moose::Util::TypeConstraints;
-class_type 'DateTime';
+
+class_type 'DateTime';
+
+
subtype 'DateTime',
+
+subtype 'DateTime',
as 'Object',
where { $_->isa('DateTime') },
message { ... };
@@ -2622,11 +2618,15 @@ class_type 'DateTime';
role_type
use Moose::Util::TypeConstraints;
-role_type 'Printable';
+
+role_type 'Printable';
+
+
subtype 'Printable',
+
+subtype 'Printable',
as 'Object',
where
{ Moose::Util::does_role(
@@ -2638,11 +2638,15 @@ role_type 'Printable';
Subtype Shortcuts - duck_type
use Moose::Util::TypeConstraints;
-duck_type Car => qw( run break_down );
+
+duck_type Car => qw( run break_down );
+
+
subtype 'Car',
+
+subtype 'Car',
as 'Object',
where { all { $_->can($_) }
qw( run break_down ) },
@@ -2653,11 +2657,15 @@ 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 );
+
+
my %ok = map { $_ => 1 }
+
+my %ok = map { $_ => 1 }
qw( red blue green );
subtype 'Color'
@@ -2672,7 +2680,9 @@ subtype 'Color'
package Person;
my $posint =
- subtype as 'Int', where { $_ > 0 };
+ subtype
+ as 'Int',
+ where { $_ > 0 };
has size => (
is => 'ro',
@@ -2830,7 +2840,7 @@ sub work {
Digression: The Type Registry
- - Types are actually
Moose::Meta::TypeConstraints
objects
+ - Types are actually
Moose::Meta::TypeConstraint
objects
- Stored in an interpreter-global registry mapping names to objects
@@ -2952,10 +2962,21 @@ has transaction_history => (
+
+
@@ -3348,82 +3373,6 @@ $person->account->deposit(100);
-
-
-
-
-
-
-
-
-
-
-
-
@@ -3664,12 +3612,13 @@ with HasCollection => { type => 'Int' };
- - Catalyst
- - CHI
- - Devel::REPL
- - Email::Sender
- - Fey
- - Net::Twitter
+ - Catalyst
+ - CHI
+ - Devel::REPL
+ - Dist::Zilla
+ - Email::Sender
+ - Fey
+ - Net::Twitter
@@ -3678,12 +3627,12 @@ with HasCollection => { type => 'Int' };