-
-
Notifications
You must be signed in to change notification settings - Fork 372
/
Spec.pm6
36 lines (31 loc) · 915 Bytes
/
Spec.pm6
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
my class VM { ... }
my class IO::Spec {
#?if moar
my constant $module = nqp::hash( # only list the non-Unix ones in lowercase
#?endif
#?if !moar
my $module := nqp::hash( # only list the non-Unix ones in lowercase
#?endif
'mswin32', 'Win32',
'os2', 'Win32',
'dos', 'Win32',
'symbian', 'Win32',
'netware', 'Win32',
'win32', 'Win32',
'cygwin', 'Cygwin',
'qnx', 'QNX',
'nto', 'QNX',
# <MacOS Mac> »=>» 'Mac',
# 'VMS' => 'VMS'
);
proto method select(|) {*}
multi method select(IO::Spec:U:) {
IO::Spec::{nqp::ifnull(nqp::atkey($module,VM.osname),'Unix')};
}
multi method select(IO::Spec:U: $token) {
IO::Spec::{nqp::ifnull(nqp::atkey($module,$token.lc),'Unix')};
}
}
# temporary non-lazy initialization of $*SPEC
PROCESS::<$SPEC> = IO::Spec.select;
# vim: expandtab shiftwidth=4