Ham::Locator(3pm)

πŸ’– Ham::Locator πŸ’–

okay bestie, gather round, because this is genuinely one of the cutest little Perl modules out there β€” it's Ham::Locator, from the User Contributed Perl Documentation pile, and it does exactly one thing but does it flawlessly: it converts between Maidenhead locators and latitude/longitude. That's it. That's the whole vibe. Grid squares in, coordinates out, coordinates in, grid squares out. πŸ”₯

If you're a ham radio girlie you already know β€” Maidenhead locators are those little letter-number combos like IO93lo that describe a spot on Earth, and sometimes you need the actual lat/lng and sometimes you need the pretty grid square. This module is your girl. No cap. πŸŽ€


✨ SYNOPSIS ✨

the whole thing, in all its glory:

use Ham::Locator;
my $m = new Ham::Locator;
$m->set_loc('IO93lo');
my ($latitude, $longitude) = $m->loc2latlng;

like… four lines. it's giving efficiency. πŸ‘‘


🌸 DEPENDENCIES 🌸

she doesn't do it alone, she has a tiny little entourage:

  • Carp</c> β€” for error handling, so when something goes wrong you get a nice sensible complaint instead of vibes
  • Class::Accessor</c> β€” for accessor method generation, i.e. it writes all the boring getter/setter boilerplate so nobody has to 🫢

πŸ‘‘ CONSTRUCTORS πŸ‘‘

Locator->new

Creates a new Ham::Locator object. That's literally it, bestie. Fresh object, main character energy, ready to convert. ✨


πŸ¦‹ ACCESSORS πŸ¦‹

these are the little knobs you turn before you ask her to do the thing:

  • $locator->set_loc(locator) β€” sets the locator you want used when converting to latitude and longitude. drop your grid square in here πŸ’…
  • $locator->set_latlng((latitude, longitude)) β€” sets the longitude and latitude you want used when converting to the locator. yes, she said longitude and latitude, that's the order in the source, we don't argue with the source 🫑
  • $locator->set_precision(precision) β€” sets the number of characters of the locator reference to return when you call latlng2loc. short locator, long locator, your call, she's flexible like that 🌈

🧚 METHODS 🧚

the two moments you've been waiting for:

  • $locator->latlng2loc β€” converts the latitude and longitude you set with set_latlng into the locator, and hands it back to you as a string. πŸŽ€
  • $locator->loc2latlng β€” converts the locator you set with set_loc into latitude and longitude, and returns them as an array of two values. two whole values, one little array, iconic. πŸ’œ

πŸ’€ CAVEATS πŸ’€

(nothing here, bestie β€” the original page leaves this one empty. silence is golden, i guess? she's just that confident.)


πŸ™ˆ BUGS πŸ™ˆ

  • None, hopefully! 😭 that's the actual note. she said hopefully. truly the most honest bug section in all of CPAN and i respect it so much.

okay legal moment, but make it cute:

This module was written by Andy Smith <andy.smith@netprojects.org.uk>. πŸ‘‘

Version tag, verbatim, because we do not mess with $Id strings:

$Id: Locator.pm 10 2011-01-16 15:36:53Z andys $

(c)2009 Andy Smith (<http://andys.org.uk/>)

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. 🫢


fr fr, if you're gonna ship this anywhere, keep that copyright block intact. it's not optional, it's a whole legal vibe. ⭐

and that's the page!! πŸ¦‹ this is Ham::Locator, shipped as part of perl v5.32.1 and dated 2022-01-03 β€” so yeah, she's been out here converting grid squares since forever and she's still slaying. go set a locator, bestie. πŸ’–βœ¨πŸŒΈ

πŸ“¦ where this page comes from