RogerBW's Blog

Building My Second First CPAN Module 13 August 2017

I wrote a CPAN module back in the day. Let's not talk about it; it wasn't very good. Recently the local Perlmongers group (ThamesValley.pm) encouraged me to modularise and release some newer code.

I chose to work on my OpenStreetMap plotter: given boundary latitudes and longitudes, it downloads OpenStreetMap tiles, crops to the right size, and provides utility functions so that you can translate lat/long coordinates of markers to pixel coordinates on the image. It's tightly tied to Imager, which at this point is clearly the best raster-image plotting module for Perl, though surprisingly under-used. The result is not a slippy map as you'd see on the OpenStreetMap site, just a static image; I wrote the code first for my beerdiary mapped reviews microsite, and amended it extensively when I got a GPS receiver and wanted to plot tracks from that.

(It was much easier when Google Maps allowed one to view KML files without having an account. But they weren't getting enough personal data from that, so they stopped.)

While one can still do the packaging process with basic commands and hand editing, the cool kids now automate it. On NeilB's advice I tried Minilla, which is not packaged in Debian and has an extensive dependency list - which is a slight problem for me, because I like to install CPAN modules as Debian packages using dh-make-perl, and therefore had to run a series of attempted setups, see which tests failed because of missing modules, install them, and repeat the process.

Minilla wants a .pause file to drive the upload process. For the syntax of this, it refers to another piece of documentation - with an incorrect link. What is this, PHP? http://search.cpan.org/~syohex/Minilla-v3.0.10/lib/Minilla.pm#CONFIGURATION refers to http://search.cpan.org/perldoc?cpan_upload#CONFIGURATION which should be http://search.cpan.org/perldoc?cpan-upload#CONFIGURATION - spot the subtle difference! All to save the effort of writing "have a plain text file, the first line being 'user' followed by your username, the second being 'password' followed by your password".

There was also some strangeness with a dummy (non-uploaded) release, and version numbers, which meant that the first release I could upload was v0.02. Hey ho. There's really very little indication of just how the Changes file is supposed to be manipulated…

On the other hand, Minilla did a great job of providing a skeleton module; while rewriting the code to fit better into this format and be more strictly encapsulated, I was able to modify it to remove a final cropping step that had been necessary in previous versions.

So now it's out there. Yay! The only feedback I've had in nearly three months since release is someone telling me I'd left out a dependency.

See the linked blog post below for example output.

See also:
Where are my 3d-printing customers?


  1. Posted by Owen Smith at 04:24pm on 13 August 2017

    I've never got my head round what a CPAN module is. Online explanations are contradictory.

  2. Posted by RogerBW at 11:49am on 17 August 2017

    CPAN is a collection of modules (libraries, if you're thinking in C terms) for Perl; most of them are free and open source.

  3. Posted by Mark Lawrence at 05:55am on 30 August 2017

    Perhaps you could tell us the name of your module or link to it? I've been looking for a way to generate map images for ages....

  4. Posted by RogerBW at 08:00am on 30 August 2017

    Oops. Geo::OSM::Imager.

Comments on this post are now closed. If you have particular grounds for adding a late comment, comment on a more recent post quoting the URL of this one.

Search
Archive
Tags 1920s 1930s 1940s 1950s 1960s 1970s 1980s 1990s 2000s 2010s 2300ad 3d printing action advent of code aeronautics aikakirja anecdote animation anime army astronomy audio audio tech base commerce battletech bayern beer boardgaming book of the week bookmonth chain of command children chris chronicle church of no redeeming virtues cold war comedy computing contemporary cornish smuggler cosmic encounter coup covid-19 crime crystal cthulhu eternal cycling dead of winter doctor who documentary drama driving drone ecchi economics en garde espionage essen 2015 essen 2016 essen 2017 essen 2018 essen 2019 essen 2022 essen 2023 essen 2024 existential risk falklands war fandom fanfic fantasy feminism film firefly first world war flash point flight simulation food garmin drive gazebo genesys geocaching geodata gin gkp gurps gurps 101 gus harpoon historical history horror hugo 2014 hugo 2015 hugo 2016 hugo 2017 hugo 2018 hugo 2019 hugo 2020 hugo 2021 hugo 2022 hugo 2023 hugo 2024 hugo-nebula reread in brief avoid instrumented life javascript julian simpson julie enfield kickstarter kotlin learn to play leaving earth linux liquor lovecraftiana lua mecha men with beards mpd museum music mystery naval noir non-fiction one for the brow opera parody paul temple perl perl weekly challenge photography podcast politics postscript powers prediction privacy project woolsack pyracantha python quantum rail raku ranting raspberry pi reading reading boardgames social real life restaurant reviews romance rpg a day rpgs ruby rust scala science fiction scythe second world war security shipwreck simutrans smartphone south atlantic war squaddies stationery steampunk stuarts suburbia superheroes suspense television the resistance the weekly challenge thirsty meeples thriller tin soldier torg toys trailers travel type 26 type 31 type 45 vietnam war war wargaming weather wives and sweethearts writing about writing x-wing young adult
Special All book reviews, All film reviews
Produced by aikakirja v0.1