#!/usr/bin/perl require "/var/bin/config/programs.conf"; eval {alarm (5)}; print "Content-type: text/html\n\n"; $SIG{ALRM}=sub{print "..."; exit}; if ($@){ if ($@ =~ /timeout/){ print "..."; } else { alarm(0); print "..."; die; } } use LeadsDB; initWebDBClient("$WEBDBNAME"); $WindVel="";$wx="";$cloud="";$wxob="";$T=""; @list = sfcObQuery(-1,"KDEN"); foreach $item (@list){ $WindDir= $item->wind_dir(); $WindVel= $item->wind_speed(); $WindGust= $item->wind_gusts(); $RH= $item->rel_humidity(); $vis= $item->visibility();$P= $item->sea_level_pressure(); $wx= $item->pres_wx1(); $cloud= $item->total_cloud_amount(); $T=$item->temp(); $Td=$item->dewpoint_temp(); if ($WindVel>250){$WindVel=""} if ($WindGust>250){$WindGust=""} if ($T< -200){$T=""} if ($T> 200){$T=""} } if($T =~ /[0-9]/){ @t=split(/\./,$T);$t1=$t[1]; if ($t1 >4){ $T=int($T*9/5+32)+1; } else{$T=int($T*9/5+32)} } if ($wx || $cloud =~ /[0-9]/){&Weather}else{$wxob=""} if ($WindDir){&Wind} if ($WindGust){ $WIND="wind $WindDir $WindVel mph gusting to $WindGust mph ... "; } elsif ($WindVel ==0){ $WIND="wind CALM ... "; }else{ $WIND="wind $WindDir $WindVel mph ... "; } if ($T =~ /3.829/){$T=""} print "Conditions at Denver: $wxob, $T F, $WIND .... "; $WindVel="";$wx="";$cloud="";$wxob="";$T="";$HOUR=""; @list = sfcObQuery(-1,"KSFO"); foreach $item (@list){ $WindDir= $item->wind_dir(); $WindVel= $item->wind_speed(); $WindGust= $item->wind_gusts(); $RH= $item->rel_humidity(); $vis= $item->visibility();$P= $item->sea_level_pressure(); $wx= $item->pres_wx1(); $cloud= $item->total_cloud_amount(); $T=$item->temp(); $Td=$item->dewpoint_temp(); } if($T =~/[0-9]/){ @t=split(/\./,$T);$t1=$t[1]; if ($t1 >4){ $T=int($T*9/5+32)+1; } else{$T=int($T*9/5+32)} } if ($wx || $cloud =~ /[0-9]/){&Weather}else{$wxob=""} if ($WindDir){&Wind} if ($WindGust){ $WIND="wind $WindDir $WindVel mph gusting to $WindGust mph ... "; } elsif ($WindVel ==0){ $WIND="wind CALM ... "; }else{ $WIND="wind $WindDir $WindVel mph ... "; } print "San Francisco Airport: $wxob, $T F, $WIND .... "; $WindVel="";$wx="";$cloud="";$wxob="";$T="";$HOUR=""; @list = sfcObQuery(-1,"KDCA"); foreach $item (@list){ $WindDir= $item->wind_dir(); $WindVel= $item->wind_speed(); $WindGust= $item->wind_gusts(); $RH= $item->rel_humidity(); $vis= $item->visibility();$P= $item->sea_level_pressure(); $wx= $item->pres_wx1(); $cloud= $item->total_cloud_amount(); $T=$item->temp(); $Td=$item->dewpoint_temp(); } if($T =~/[0-9]/){ @t=split(/\./,$T);$t1=$t[1]; if ($t1 >4){ $T=int($T*9/5+32)+1; } else{$T=int($T*9/5+32)} } if ($wx || $cloud =~ /[0-9]/){&Weather}else{$wxob=""} if ($WindDir){&Wind} if ($WindGust){ $WIND="wind $WindDir $WindVel mph gusting to $WindGust mph ... "; } elsif ($WindVel ==0){ $WIND="wind CALM ... "; }else{ $WIND="wind $WindDir $WindVel mph ... "; } print "Washington DC: $wxob, $T F, $WIND ...."; $WindVel="";$wx="";$cloud="";$wxob="";$T="";$HOUR=""; @list = sfcObQuery(-1,"KMWN"); foreach $item (@list){ $WindDir= $item->wind_dir(); $WindVel= $item->wind_speed(); $WindGust= $item->wind_gusts(); $RH= $item->rel_humidity(); $vis= $item->visibility();$P= $item->sea_level_pressure(); $wx= $item->pres_wx1(); $cloud= $item->total_cloud_amount(); $T=$item->temp(); $Td=$item->dewpoint_temp(); } if($T =~/[0-9]/){ @t=split(/\./,$T);$t1=$t[1]; if ($t1 >4){ $T=int($T*9/5+32)+1; } else{$T=int($T*9/5+32)} } if ($wx || $cloud =~ /[0-9]/){&Weather}else{$wxob=""} if ($WindDir){&Wind} if ($WindGust){ $WIND="wind $WindDir $WindVel mph gusting to $WindGust mph ... "; } elsif ($WindVel ==0){ $WIND="wind CALM ... "; }else{ $WIND="wind $WindDir $WindVel mph ... "; } print "Mount Washington: $wxob, $T F, $WIND .... "; $WindVel="";$wx="";$cloud="";$wxob="";$T="";$HOUR=""; @list = sfcObQuery(-1,"KMIA"); foreach $item (@list){ $WindDir= $item->wind_dir(); $WindVel= $item->wind_speed(); $WindGust= $item->wind_gusts(); $RH= $item->rel_humidity(); $vis= $item->visibility();$P= $item->sea_level_pressure(); $wx= $item->pres_wx1(); $cloud= $item->total_cloud_amount(); $T=$item->temp(); $Td=$item->dewpoint_temp(); } if($T =~/[0-9]/){ @t=split(/\./,$T);$t1=$t[1]; if ($t1 >4){ $T=int($T*9/5+32)+1; } else{$T=int($T*9/5+32)} } if ($wx || $cloud =~ /[0-9]/){&Weather}else{$wxob=""} if ($WindDir){&Wind} if ($WindGust){ $WIND="wind $WindDir $WindVel mph gusting to $WindGust mph ... "; } elsif ($WindVel ==0){ $WIND="wind CALM ... "; }else{ $WIND="wind $WindDir $WindVel mph ... "; } print "Miami: $wxob, $T F, $WIND .... "; $WindVel="";$wx="";$cloud="";$wxob="";$T="";$HOUR=""; @list = sfcObQuery(-1,"KLAX"); foreach $item (@list){ $WindDir= $item->wind_dir(); $WindVel= $item->wind_speed(); $WindGust= $item->wind_gusts(); $RH= $item->rel_humidity(); $vis= $item->visibility();$P= $item->sea_level_pressure(); $wx= $item->pres_wx1(); $cloud= $item->total_cloud_amount(); $T=$item->temp(); $Td=$item->dewpoint_temp(); } if($T =~/[0-9]/){ @t=split(/\./,$T);$t1=$t[1]; if ($t1 >4){ $T=int($T*9/5+32)+1; } else{$T=int($T*9/5+32)} } if ($wx || $cloud =~ /[0-9]/){&Weather}else{$wxob=""} if ($WindDir){&Wind} if ($WindGust){ $WIND="wind $WindDir $WindVel mph gusting to $WindGust mph ... "; } elsif ($WindVel ==0){ $WIND="wind CALM ... "; }else{ $WIND="wind $WindDir $WindVel mph ... "; } print "Los Angeles: $wxob, $T F, $WIND .... "; sub Weather{ if ($cloud >=0 && $cloud <3){$wxicon=1;$wxob="Clear"} if ($cloud >=3 && $cloud <5){$wxicon=2;$wxob="Partly Cloudy"} if ($cloud >=5 && $cloud <7){$wxicon=3;$wxob="Mostly Cloudy"} if ($cloud >=7){$wxicon=4;$wxob="Cloudy"} if ($wx == 4){$wxicon=1;$wxob="Smoke"} elsif ($wx == 5){$wxicon=7;$wxob="Haze"} elsif ($wx == 6){$wxicon=7;$wxob="Dust"} elsif ($wx == 7){$wxicon=10;$wxob="Blowing Dust/Sand"} elsif ($wx == 8){$wxicon=10;$wxob="Some Blowing Dust/Sand"} elsif ($wx == 9){$wxicon=10;$wxob="Dust/Sand Storm"} elsif ($wx == 10){$wxicon=4;$wxob="Mist"} elsif ($wx == 11){$wxicon=8;$wxob="Patchy Fog"} elsif ($wx == 12){$wxicon=8;$wxob="Fog"} elsif ($wx == 13){$wxicon=34;$wxob="Thunder nearby"} elsif ($wx == 14){$wxicon=13;$wxob="Showers nearby"} elsif ($wx == 15){$wxicon=13;$wxob="Showers nearby"} elsif ($wx == 16){$wxicon=13;$wxob="Showers nearby"} elsif ($wx == 17){$wxicon=34;$wxob="Thunder"} elsif ($wx == 18){$wxicon=13;$wxob="Squall nearby"} elsif ($wx == 19){$wxicon=35;$wxob="Funnel Cloud!"} elsif ($wx == 20){$wxicon=13;$wxob="Drizzle"} elsif ($wx == 21){$wxicon=13;$wxob="Light Showers"} elsif ($wx == 22){$wxicon=23;$wxob="Snow Showers"} elsif ($wx == 23){$wxicon=21;$wxob="Rain/Snow Showers"} elsif ($wx == 24){$wxicon=20;$wxob="Freezing drizzle"} elsif ($wx == 25){$wxicon=13;$wxob="Showers"} elsif ($wx == 26){$wxicon=23;$wxob="Snow Showers"} elsif ($wx == 27){$wxicon=13;$wxob="Showers with Hail"} elsif ($wx == 28){$wxicon=8;$wxob="Ice Fog"} elsif ($wx == 29){$wxicon=34;$wxob="Thunderstorm"} elsif ($wx == 30){$wxicon=10;$wxob="Blowing Dust/Sand"} elsif ($wx == 31){$wxicon=10;$wxob="Blowing Dust/Sand"} elsif ($wx == 32){$wxicon=10;$wxob="Blowing Dust/Sand"} elsif ($wx == 33){$wxicon=10;$wxob="Blowing Dust/Sand"} elsif ($wx == 34){$wxicon=10;$wxob="Blowing Dust/Sand"} elsif ($wx == 35){$wxicon=10;$wxob="Blowing Dust/Sand"} elsif ($wx == 36){$wxicon=10;$wxob="Drifting Snow"} elsif ($wx == 37){$wxicon=10;$wxob="Heavy Drifting Snow"} elsif ($wx == 38){$wxicon=10;$wxob="Blowing Snow"} elsif ($wx == 39){$wxicon=10;$wxob="Heavy Blowing Snow"} elsif ($wx == 40){$wxicon=8;$wxob="Fog Nearby"} elsif ($wx == 41){$wxicon=8;$wxob="Patchy Fog"} elsif ($wx == 42){$wxicon=8;$wxob="Light Fog"} elsif ($wx == 43){$wxicon=8;$wxob="Fog"} elsif ($wx == 44){$wxicon=8;$wxob="Light Fog"} elsif ($wx == 45){$wxicon=8;$wxob="Fog"} elsif ($wx == 46){$wxicon=8;$wxob="Fog"} elsif ($wx == 47){$wxicon=8;$wxob="Fog"} elsif ($wx == 48){$wxicon=8;$wxob="Light Fog"} elsif ($wx == 49){$wxicon=8;$wxob="Fog"} elsif ($wx == 50){$wxicon=13;$wxob="Drizzle"} elsif ($wx == 51){$wxicon=13;$wxob="Drizzle"} elsif ($wx == 52){$wxicon=13;$wxob="Drizzle"} elsif ($wx == 53){$wxicon=13;$wxob="Drizzle"} elsif ($wx == 54){$wxicon=13;$wxob="Heavy Drizzle"} elsif ($wx == 55){$wxicon=13;$wxob="Drizzle"} elsif ($wx == 56){$wxicon=20;$wxob="Freezing Drizzle"} elsif ($wx == 57){$wxicon=20;$wxob="Heavy Freezing Drizzle"} elsif ($wx == 58){$wxicon=20;$wxob="Rain/Drizzle"} elsif ($wx == 59){$wxicon=20;$wxob="Heavy Rain/Drizzle"} elsif ($wx == 60){$wxicon=16;$wxob="Light Rain"} elsif ($wx == 61){$wxicon=17;$wxob="Rain"} elsif ($wx == 62){$wxicon=17;$wxob="Rain"} elsif ($wx == 63){$wxicon=17;$wxob="Rain"} elsif ($wx == 64){$wxicon=18;$wxob="Heavy Rain"} elsif ($wx == 65){$wxicon=18;$wxob="Heavy Rain"} elsif ($wx == 66){$wxicon=20;$wxob="Light Freezing Rain"} elsif ($wx == 67){$wxicon=20;$wxob="Heavy Freezing Rain"} elsif ($wx == 68){$wxicon=22;$wxob="Light Rain and Snow"} elsif ($wx == 69){$wxicon=22;$wxob="Heavy Rain and Snow"} elsif ($wx == 70){$wxicon=29;$wxob="Light Snow"} elsif ($wx == 71){$wxicon=30;$wxob="Snow"} elsif ($wx == 72){$wxicon=30;$wxob="Snow"} elsif ($wx == 73){$wxicon=30;$wxob="Snow"} elsif ($wx == 74){$wxicon=31;$wxob="Heavy Snow"} elsif ($wx == 75){$wxicon=31;$wxob="Heavy Snow"} elsif ($wx == 76){$wxicon=29;$wxob="Ice Crystals"} elsif ($wx == 77){$wxicon=29;$wxob="Snow Grains"} elsif ($wx == 78){$wxicon=29;$wxob="Ice Crystals"} elsif ($wx == 79){$wxicon=29;$wxob="Ice Pellets"} elsif ($wx == 80){$wxicon=13;$wxob="Light Showers"} elsif ($wx == 81){$wxicon=13;$wxob="Showers"} elsif ($wx == 82){$wxicon=18;$wxob="Heavy Showers"} elsif ($wx == 83){$wxicon=21;$wxob="Rain and Snow Showers"} elsif ($wx == 84){$wxicon=1;$wxob="Rain and Snow Showers"} elsif ($wx == 85){$wxicon=23;$wxob="Light Snow Showers"} elsif ($wx == 86){$wxicon=23;$wxob="Snow Showers"} elsif ($wx == 87){$wxicon=23;$wxob="Snow Pellets/Hail"} elsif ($wx == 88){$wxicon=23;$wxob="Snow Pellets/Hail"} elsif ($wx == 89){$wxicon=34;$wxob="Hail"} elsif ($wx == 90){$wxicon=22;$wxob="Rain and Snow"} elsif ($wx == 91){$wxicon=34;$wxob="Light Thunderstorm"} elsif ($wx == 92){$wxicon=34;$wxob="Thunderstorm"} elsif ($wx == 93){$wxicon=34;$wxob="Thunderstorm"} elsif ($wx == 94){$wxicon=34;$wxob="Thunderstorm"} elsif ($wx == 95){$wxicon=34;$wxob="Thunderstorm"} elsif ($wx == 96){$wxicon=35;$wxob="Thunderstorm with Hail"} elsif ($wx == 97){$wxicon=35;$wxob="Heavy Thunderstorm"} elsif ($wx == 98){$wxicon=34;$wxob="Thunderstorm and Dust Storm"} elsif ($wx == 99){$wxicon=35;$wxob="Heavy Thunderstorm with Hail"} } sub Wind{ if ($WindDir < 11.25 || $WindDir > 348.75){ $WindDir = "N"; } elsif ($WindDir > 11.25 && $WindDir < 33.75){ $WindDir = NNE; } elsif ($WindDir > 33.75 && $WindDir < 56.25){ $WindDir = "NE"; } elsif ($WindDir > 56.25 && $WindDir < 78.75){ $WindDir = "ENE"; } elsif ($WindDir > 78.75 && $WindDir < 101.25){ $WindDir = E; } elsif ($WindDir > 101.25 && $WindDir < 123.75){ $WindDir = ESE; } elsif ($WindDir > 123.75 && $WindDir < 146.25){ $WindDir = SE; } elsif ($WindDir > 146.25 && $WindDir < 168.75){ $WindDir = SSE; } elsif ($WindDir > 168.75 && $WindDir < 191.25){ $WindDir = S; } elsif ($WindDir > 191.25 && $WindDir < 213.75){ $WindDir = SSW; } elsif ($WindDir > 213.75 && $WindDir < 236.25){ $WindDir = SW; } elsif ($WindDir > 236.25 && $WindDir < 258.75){ $WindDir = WSW; } elsif ($WindDir > 258.75 && $WindDir < 281.25){ $WindDir = W; } elsif ($WindDir > 281.25 && $WindDir < 303.75){ $WindDir = WNW; } elsif ($WindDir > 303.75 && $WindDir < 326.25){ $WindDir = NW; } elsif ($WindDir > 326.25 && $WindDir < 348.75){ $WindDir = NW; } elsif ($WindDir > 303.75 && $WindDir < 326.25){ $WindDir = NW; } } sub die{ print "die"; }