X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=moose-class%2Fslides%2Findex.html;h=f271e011105a567e0a1171cc38f8cc94687416b7;hb=HEAD;hp=3c0ba3102f2fe13623b8ca7e865034a493c52200;hpb=bdd3911c83c8a0dc99a60d6666fa1b0fe726734c;p=gitmo%2Fmoose-presentations.git diff --git a/moose-class/slides/index.html b/moose-class/slides/index.html index 3c0ba31..f271e01 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,22 +1485,6 @@ Integer->does('Comparable'); # also true!
-
-
+
+
@@ -2410,9 +2412,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 { ... };
@@ -2632,11 +2638,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(
@@ -2648,11 +2658,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 ) },
@@ -2663,11 +2677,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'
@@ -2682,7 +2700,9 @@ subtype 'Color'
package Person;
my $posint =
- subtype as 'Int', where { $_ > 0 };
+ subtype
+ as 'Int',
+ where { $_ > 0 };
has size => (
is => 'ro',
@@ -2840,7 +2860,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
@@ -2962,10 +2982,21 @@ has transaction_history => (
+
+
+
+
@@ -3279,7 +3333,7 @@ has history => (
package Person;
use Moose;
has _favorite_numbers => (
- traits => [ 'Array' ],
+ traits => [ 'Array' ],
isa => 'ArrayRef[Int]',
default => sub { [] },
init_arg => undef,
@@ -3358,82 +3412,6 @@ $person->account->deposit(100);
-
-
-
-
-
-
-
-
-
-
-
-
@@ -3674,12 +3651,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
@@ -3688,12 +3666,12 @@ with HasCollection => { type => 'Int' };
- http://moose.perl.org/
- - Moose::Manual and Moose::Cookbook
+ - Moose::Manual and Moose::Cookbook
- irc://irc.perl.org/#moose
- mailing list - moose@perl.org
- Slides and exercises are in Moose's git repo:
- git://jules.scsys.co.uk/gitmo/moose-presentations
+ git://git.moose.perl.org/moose-presentations.git
@@ -3707,7 +3685,7 @@ with HasCollection => { type => 'Int' };