What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 127 Stack Exchange communities.

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.

QUESTION

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

share|improve this question

migrated from stackoverflow.com Jan 24 '11 at 17:22

This question came from our site for professional and enthusiast programmers.

1  
Belongs on meta.stackoverflow.com ? –  Paul R Jan 24 '11 at 12:14
    
@Paul - Don't think so since I think the correct answer may be programmatic (e.g. a script) –  DVK Jan 24 '11 at 12:27
    
This was already asked (and answered) on meta: meta.stackexchange.com/questions/17105/… –  Ether Jan 24 '11 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 '11 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 '11 at 0:31
add comment

5 Answers

up vote 17 down vote accepted

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.

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

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.

share|improve this answer
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 '11 at 15:38
add comment

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.

share|improve this answer
    
For a specific module POD, search.cpan.org/perldoc/Dist::Zilla::Plugin::MetaJSON or search.cpan.org/perldoc?Dist::Zilla::Plugin::MetaJSON are equivalent to your suggestion. –  ysth Jan 24 '11 at 17:58
    
Most of those assume that the files you link to will always be in the distribution in the same place. –  brian d foy Feb 27 '11 at 14:16
add comment

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.

share|improve this answer
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 '11 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 '11 at 21:02
    
There's no guarantee that linking directly into a particular file in a distro will be a stable link. –  brian d foy Feb 27 '11 at 14:15
add comment

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.

share|improve this answer
add comment

You must log in to answer this question.

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