Commit | Line | Data |
b751d33f |
1 | = Intro (30 minutes) |
2 | |
3 | * concepts (ala Moose::Manual::Concepts) |
4 | |
5 | = Classes |
6 | |
7 | * Making a class use Moose |
8 | * extends |
9 | * overrides/super |
10 | * trivial attributes |
11 | ** has 'foo' => ( is => ... ) (ro & rw) |
12 | ** no other attribute features yet |
13 | * "no Moose" |
14 | * Immutability |
15 | |
16 | == Exercises |
17 | |
18 | * Build a Person class that uses Moose |
19 | ** first_name |
20 | ** last_name |
21 | ** assume both attributes are always provided |
22 | * build an Employee class that is a subclass of Person |
23 | ** job_title |
24 | |
25 | = Roles |
26 | |
27 | * Making a role |
28 | * roles as interfaces |
29 | * requires |
30 | * consuming roles in classes |
31 | * consuming roles in roles |
32 | * "no Moose::Role" |
33 | |
34 | == Exercises |
35 | |
36 | * build a role for Human |
37 | * make the Person class consume the role |
38 | * make the role require a "full_name" method |
39 | * implement this method for Person |
40 | * override it for Employee to include their title |
41 | |
42 | = Basic attributes |
43 | |
44 | * required |
45 | * default & builder |
46 | * lazy |
47 | * init_arg |
48 | |
49 | == Exercises |
50 | |
51 | * Go back to Person class |
52 | ** make first & last name required |
53 | * Go back to Employee |
54 | ** make title default to "Worker" |
55 | ** add salary_level attribute, number from 1-10 |
56 | ** salary, lazy default of salary_level * 1,000, init_arg is undef |
57 | |
58 | = Method modifiers |
59 | |
60 | * before/after |
61 | ** before for state validation |
62 | ** after for additional state changes |
63 | * around |
64 | ** modifying arguments & return values |
65 | |
66 | == Exercises |
67 | |
68 | = More roles |
69 | |
70 | * methods and attributes |
71 | * method modifiers (and requiring the wrapped method) |
72 | * attributes in roles |
73 | |
74 | == Exercises |
75 | |
76 | = Advanced attributes |
77 | |
78 | * delegation |
79 | * metaclass & traits |
80 | |
81 | == Exercises |
82 | |
83 | = Types |
84 | |
85 | * built-in types |
86 | * parameterizable types |
87 | * declaring subtypes |
88 | ** URI |
89 | ** Email |
90 | ** class names & role names |
91 | * coercions |
92 | * attribute isa & does |
93 | |
94 | == Exercises |
95 | |
96 | = Introspection |
97 | |
98 | == Exercises |
99 | |
100 | = MooseX |
101 | |
102 | == Exercises |