/
Systemic.pm
42 lines (38 loc) · 1.09 KB
/
Systemic.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
role Systemic {
has Str $.name;
has Str $.auth;
has Version $.version;
has Blob $.signature;
has Str $.desc;
submethod BUILD(
:$!name = "unknown",
:$!auth = "unknown",
:$!version = Version.new("unknown")
--> Nil
) { }
multi method gist(Systemic:D:) {
$.name ~ (" ($!version)" if $.version.gist ne "vunknown")
}
method Str { $.name }
}
# Since we cannot see attributes of roles done by other roles, the below is
# a copy of the above (minus .desc), instead of doing the Universal role in
# Systemic (as is the spec). Once we can see attributes of roles of roles
# inside a class, we can fix this abomination.
role Universal {
has Str $.name;
has Str $.auth;
has Version $.version;
has Blob $.signature;
submethod BUILD(
:$!name = "unknown",
:$!auth = "unknown",
:$!version = Version.new("unknown"),
--> Nil
) {}
multi method gist(Universal:D:) {
$!name ~ (" ($!version)" if $!version.gist ne "vunknown")
}
method Str { $!name }
}
# vim: ft=perl6 expandtab sw=4