1. my class VM { ... }
  2. my class IO::Spec {
  3. my %module = # only list the non-Unix ones in lowercase
  4. 'mswin32' => 'Win32',
  5. 'os2' => 'Win32',
  6. 'dos' => 'Win32',
  7. 'symbian' => 'Win32',
  8. 'netware' => 'Win32',
  9. 'win32' => 'Win32',
  10. 'cygwin' => 'Cygwin',
  11. 'qnx' => 'QNX',
  12. 'nto' => 'QNX',
  13. # <MacOS Mac> »=>» 'Mac',
  14. # 'VMS' => 'VMS'
  15. ;
  16. method select(IO::Spec:U: $token?) {
  17. IO::Spec::{%module{ lc($token // VM.osname) } // 'Unix'};
  18. }
  19. }
  20. # temporary non-lazy initialization of $*SPEC
  21. PROCESS::<$SPEC> = IO::Spec.select;