Created
September 30, 2015 00:53
-
-
Save zoffixznet/25ae04641002f8a1fa04 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Employee { | |
subset Salary of Real where * > 0; | |
subset NonEmptyString of Str where * ~~ /\S/; # at least one non-space character | |
has NonEmptyString $.name is rw; | |
has NonEmptyString $.surname is rw; | |
has Salary $.salary is rw; | |
method gist { | |
return qq:to[END]; | |
Name: $.name | |
Surname: $.surname | |
Salary: $.salary | |
END | |
} | |
} | |
my $employee = Employee.new(); | |
$employee | |
.name = 'Sally'; | |
.surname = 'Ride'; | |
.salary = 200; | |
say $employee; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment