Skip to content

Instantly share code, notes, and snippets.

@zoffixznet
Created September 30, 2015 00:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zoffixznet/25ae04641002f8a1fa04 to your computer and use it in GitHub Desktop.
Save zoffixznet/25ae04641002f8a1fa04 to your computer and use it in GitHub Desktop.
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