Commit | Line | Data |
5cab7e05 |
1 | # Your tasks ... |
ddd87d75 |
2 | # |
3 | # Create a Person class in lib/Person.pm |
4 | # |
5 | # A Person has the following attributes: |
6 | # |
7 | # * first_name - read-write |
8 | # * last_name - read-write |
9 | # |
83c2705f |
10 | # This class should also have a method named "full_name". This |
ebd58599 |
11 | # method should return the first and last name separated by a space |
ddd87d75 |
12 | # ("Jon Smith"). |
13 | # |
f7da468c |
14 | # Write a BUILDARGS method for this class which allows the caller to |
15 | # pass a two argument array reference. These should be assigned to the |
16 | # first and last name respectively. |
17 | # |
18 | # Person->new( [ 'Lisa', 'Smith' ] ); |
19 | # |
5a75c981 |
20 | # Hint: A quick and dirty way to check for this is to use ref() to check if |
21 | # the first value in @_ is an array reference (perldoc -f ref). A nicer way to |
22 | # do this would be use to use Scalar::Util::reftype(). |
83c05a59 |
23 | # |
ddd87d75 |
24 | # Create an Employee class in lib/Employee.pm |
25 | # |
26 | # The Employee class is a subclass of Person |
27 | # |
5adb28a8 |
28 | # An Employee has the following attributes: |
ddd87d75 |
29 | # |
8d1ce1d7 |
30 | # * title - read-write |
ddd87d75 |
31 | # * salary - read-write |
32 | # * ssn - read-only |
33 | # |
83c2705f |
34 | # The Employee class should override the "full_name" method to |
ddd87d75 |
35 | # append the employee's title in parentheses ("Jon Smith |
36 | # (Programmer)"). Use override() and super() for this. |
37 | # |
38 | # Finally, both classes should be free of Moose droppings, and should be |
39 | # immutable. |
40 | |
41 | use strict; |
42 | use warnings; |
43 | |
44 | use lib 't/lib'; |
ba1c9923 |
45 | |
ddd87d75 |
46 | use MooseClass::Tests; |
47 | |
ddd87d75 |
48 | MooseClass::Tests::tests01(); |