spacepaste

  1.  
  2. my $record = $gi->record_by_addr($ip);
  3. my @values = map { sprintf $_[0], namify($_[1]), $gi->$_[1] } (
  4. '%s' => 'country',
  5. '%s' => 'region',
  6. '%s' => 'city',
  7. '%s' => 'postal_code',
  8. '%.2f' => 'latitude',
  9. '%s' => 'longitude',
  10. '%s' => 'time_zone',
  11. );
  12. my $command = sprintf('say IP: (%s) Hostname: $hostname %s',
  13. $ip, $hostname, join(' ', @values),
  14. );
  15. Xchat::command($command);
  16. sub namify {
  17. return join ' ', map { ucfirst } split /_/, shift;
  18. }
  19.