spacepaste

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