comparison reproctool.cgi @ 35:7d9abc345081

Handling mineral defaults correctly
author Dominic Cleal <dominic@computerkb.co.uk>
date Sun, 25 Jan 2009 18:08:23 +0000
parents a4197a854e79
children e8772d1bd517
comparison
equal deleted inserted replaced
33:a4197a854e79 35:7d9abc345081
65 } 65 }
66 } 66 }
67 67
68 unless ($marks) 68 unless ($marks)
69 { 69 {
70 # User can enter their own numbers if eve-central was down
71 $marks->{$_} = 1 foreach ('Tritanium', 'Pyerite', 'Mexallon',
72 'Isogen', 'Nocxium', 'Zydrine',
73 'Megacyte', 'Morphite');
74
70 # If cache was unavailable or had expired, pull again from eve-central 75 # If cache was unavailable or had expired, pull again from eve-central
71 my $ua = LWP::UserAgent->new; 76 my $ua = LWP::UserAgent->new;
72 $ua->agent('reproctool'); 77 $ua->agent('reproctool');
73 my $resp = $ua->request(HTTP::Request->new(GET => $eve_central_url)); 78 my $resp = $ua->request(HTTP::Request->new(GET => $eve_central_url));
74 79
91 # Store into the cache 96 # Store into the cache
92 open CACHE, "> $marks_cache" 97 open CACHE, "> $marks_cache"
93 || die("Can't open cache $marks_cache to write: $!"); 98 || die("Can't open cache $marks_cache to write: $!");
94 store_fd($marks, *CACHE) || die("Can't write to cache: $!"); 99 store_fd($marks, *CACHE) || die("Can't write to cache: $!");
95 close CACHE; 100 close CACHE;
96 }
97 else
98 {
99 # User can enter their own numbers if eve-central was down
100 $marks->{$_} = 1 foreach ('Tritanium', 'Pyerite', 'Mexallon',
101 'Isogen', 'Nocxium', 'Zydrine',
102 'Megacyte', 'Morphite');
103 } 101 }
104 } 102 }
105 103
106 delete $marks->{timestamp} if exists $marks->{timestamp}; 104 delete $marks->{timestamp} if exists $marks->{timestamp};
107 105