There are a couple of different ways to provide URLs for CPAN modules.

The Best Practice (very well documented in this Meta SO post) is to generate a link using http://search.cpan.org/perldoc URL, as follows:

  • Desired Module: Rose::HTML::Form::Field
  • URL to use: http://search.cpan.org/perldoc?Rose::HTML::Form::Field
  • Resulting Link: Rose::HTML::Form::Field

Unfortunately, there is a problem with following that Best Practice consistently, at least in the usual mode I operate in when answering SO [Perl] tag questions; which for me is:

  • Googling for the module name
  • Follow the (usually correct) link to the module's POD
  • Confirm whatever is needed in the POD and/or copy/paste short examples from Synopsis if needed
  • Place the link to the module into the answer by copying and pasting the URL of the POD I opened.
  • PROBLEM: cpan.org always automatically re-directs the "canonical" version-independent URL shown above into a version-and-author-specific URL: http://search.cpan.org/~jsiracusa/Rose-HTML-Objects-0.611/lib/Rose/HTML/Form/Field.pm Therefore, the URL I copy/paste into the link in my answer is a bad one, not the canonical one.

I can use the three obvious solutions:

  1. Let cjm edit the answer afterwards with the correct URL. No headache for my lazy head and Gold Copy Editor Badge for cjm :)

  2. Memorize the damn cpan.org's search URL prefix and type it every time. This is not an efficient use of either memory or time IMHO.

  3. Use p3rl.org Perl resource re-director: http://p3rl.org/Rose::HTML::Form::Field

    This is a lot easier than #2 as far as effort level, but my concern is "what happens if p3rl.org disappears?". It's also not quite copy/paste and thus subject to typos.


Are there other approaches I can use that are better? I was thinking of some kind of FireFox or greasemonkey add-on that would generate a link. The way I see this would be to piggyback on Markdown editor and perhaps add an icon for "Link to Perl resource" in addition to usual "Make a generic URL" one

  • 1
    Belongs on meta.stackoverflow.com ?
    – Paul R
    Jan 24, 2011 at 12:14
  • @Paul - Don't think so since I think the correct answer may be programmatic (e.g. a script)
    – DVK
    Jan 24, 2011 at 12:27
  • This was already asked (and answered) on meta: meta.stackexchange.com/questions/17105/…
    – Ether
    Jan 24, 2011 at 15:51
  • @Ether - please read carefully. I specifically linked to that question, which answered "how to form a URL", and my question was "how do I efficiently form the URL that the linked question recommends (e.g. with 1/2 clicks/keystrokes).
    – DVK
    Jan 24, 2011 at 17:58
  • I actually did see that you already referenced that question. I was trying to say that this question didn't ask anything extra on top of that one (IMHO).
    – Ether
    Jan 25, 2011 at 0:31

5 Answers 5


http://search.cpan.org/~jsiracusa/Rose-HTML-Objects-0.611/lib/Rose/HTML/Form/Field.pm has a link marked "permalink" in the top right. Right click on it, and copy link location instead of going to the address bar.

  • Hmm... looks like I was over-complicating things and CPAN already has an answer I just didn't notice. +1
    – DVK
    Jan 24, 2011 at 15:00
  • It took me a long time to spot it too
    – Quentin
    Jan 24, 2011 at 15:06
  • That's the way I do it. :-)
    – cjm
    Jan 24, 2011 at 20:59

Hi, as the owner and maintainer of p3rl.org, I have no intention of letting it disappear. :)

If you have specific questions or concerns, please contact me directly.

  • 1
    @Juerd - First - Good job! I really appreciate the resource! Second - no concerns specific to your website - merely the expectation that all good things in life have a chance to disappear. Heck, even ones run and supported by Google do (e.g. Google Notebook).
    – DVK
    Jan 24, 2011 at 15:38

As an example, were I to link to Dist::Zilla, I'd use:

The added value is that it's not tied to a specific version release.


I prefer to link to the distribution rather than the documentation of one module within the distribution. The top-level distribution page leads to all of the other links for the distribution. I think you're being a bit weasly in your assertion about best practices by ignoring the first advice given in the answer to that Meta post.

I don't see what's so hard about making the link or remembering CPAN Search's prefix.

  • 1
    Sorry but I see the linked best practices as two SEPARATE advices for two SEPARATE situations - one for when you need to link to a distribution, one when you need to link to specific module's POD. Usually when I answer a question, the context is such that a link to module's POD is more useful. As far as "what's so hard" - it's harder than NOT to. In my line of work people generally care about programmatic solutions to think that otherwise require rote memorization and manual typing where it's not needed, so that's the way I usually view the issues.
    – DVK
    Jan 24, 2011 at 14:59
  • BTW, there's a similar permalink in the upper right corner of the dist page, for people who prefer linking to that.
    – cjm
    Jan 24, 2011 at 21:02
  • There's no guarantee that linking directly into a particular file in a distro will be a stable link. Feb 27, 2011 at 14:15

Ignoring the "efficiently", I try to always test any links in my posts' previews, even if I just copy and pasted them from a location bar.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .