-
Notifications
You must be signed in to change notification settings - Fork 213
/
cp562an
39 lines (29 loc) · 807 Bytes
/
cp562an
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
name 'cp562an';
description 'Use CP5.6.2AN (or other similar) mirrors';
author 'Tatsuhiko Miyagawa';
api_version 0.1;
my $mirror_base = 'http://cp__WHAT__an.barnyard.co.uk/';
# TODO: maybe hook as a command?
hook search_module => sub {
my $args = shift;
my $what = detect_platform();
if ($what) {
my $mirror = $mirror_base;
$mirror =~ s/__WHAT__/$what/;
$args->{app}->chat("Using $mirror");
# TODO query the mirror
}
return;
};
sub detect_platform {
if ($] eq '5.008008') {
return '5.8.8';
} elsif ($] eq '5.008009') {
return '5.8.9';
} elsif ($] eq '5.006002') {
return '5.6.2';
}
my %p = map { $_ => 1 } qw( MSWin32 cygwin irix netbsd solaris );
return $^O if $p{$^O};
return;
}