Slight grammar tweak
[gitmo/moose-presentations.git] / moose-class / exercises / t / 01-classes.t
1 # Your tasks ...
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 #
10 # This class should also have a method named "full_name". This
11 # method should return the first and last name separated by a string
12 # ("Jon Smith").
13 #
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 #
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().
23 #
24 # Create an Employee class in lib/Employee.pm
25 #
26 # The Employee class is a subclass of Person
27 #
28 # An Employee has the following read-write attributes:
29 #
30 # * title - read-write
31 # * salary - read-write
32 # * ssn - read-only
33 #
34 # The Employee class should override the "full_name" method to
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';
45
46 use MooseClass::Tests;
47
48 use Person;
49 use Employee;
50
51 MooseClass::Tests::tests01();