document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. use Weather::Google;
  2. # Подключаем модуль
  3. my $MyCity = ip2city($ENV{\'REMOTE_ADDR\'});
  4. # Получаем название города
  5. $weather = new Weather::Google($MyCity, {language => \'ru\'});
  6. # Формируем запрос к Google
  7. if( !$weather->temp_c) {$weather = new Weather::Google(\'Moscow\', {language => \'ru\'})}
  8. # Если нет данных по городу, устанавливаем по умолчанию любой другой
  9. @data = $weather->current qw(temp_c icon humidity wind_condition condition);
  10. # Формируем массив с запрошенными данными
  11. print for @data;
  12. # Выводим содержимое массива
');