X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=moose-class%2Fslides%2Findex.html;h=46ac36ab9225822fa1e8e023c01e5960fceb5602;hb=66b11069294324c31214650bd2e466fb75acd1f5;hp=e5124b08b236961ef1ade0405494618a0138ff58;hpb=7a6b3be97e92f349cc4525256a12d96000dc070a;p=gitmo%2Fmoose-presentations.git diff --git a/moose-class/slides/index.html b/moose-class/slides/index.html index e5124b0..46ac36a 100644 --- a/moose-class/slides/index.html +++ b/moose-class/slides/index.html @@ -52,7 +52,7 @@ img#me05 {top: 43px;left: 36px;}
@@ -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,34 +1485,6 @@ Integer->does('Comparable'); # also true!
-
-
-
-
+
+
@@ -2421,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 { ... };
@@ -2643,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(
@@ -2659,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 ) },
@@ -2674,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'
@@ -2693,7 +2680,9 @@ subtype 'Color'
package Person;
my $posint =
- subtype as 'Int', where { $_ > 0 };
+ subtype
+ as 'Int',
+ where { $_ > 0 };
has size => (
is => 'ro',
@@ -2752,7 +2741,8 @@ coerce 'My::DateTime',
@@ -2972,10 +2962,21 @@ has transaction_history => (
+
+
@@ -3289,8 +3294,7 @@ has history => (
package Person;
use Moose;
has _favorite_numbers => (
- traits => [ 'Array' ],
- is => 'bare',
+ traits => [ 'Array' ],
isa => 'ArrayRef[Int]',
default => sub { [] },
init_arg => undef,
@@ -3353,7 +3357,7 @@ has account => (
isa => 'BankAccount',
handles => {
receive_100 =>
- [ 'deposit', 100 ]
+ [ 'deposit', 100 ],
give_100 =>
[ 'withdraw', 100 ]
},
@@ -3369,82 +3373,6 @@ $person->account->deposit(100);
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -3508,7 +3439,7 @@ Iterate til this passes all its tests
MooseX::Declare
use MooseX::Declare;
-use 5.10.0; # for say
+use 5.12.0; # for say
class Person {
has greeting =>
@@ -3527,7 +3458,7 @@ class Person {
Still experimental-ish, but seeing more and more use
Not a source filter!
Hooks into the Perl parser rather than filtering all your code
- But not supported by PPI
, perltidy
, etc. (yet?)
+ But not supported by PPI
, perltidy
, etc. (yet?)
@@ -3681,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
@@ -3695,12 +3627,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
@@ -3714,7 +3646,7 @@ with HasCollection => { type => 'Int' };