Re: Proposal - Update shortcuts pointing to cpan.org to link to mcpan.org
by LanX (Saint) on Jun 03, 2014 at 11:44 UTC
|
We had a similar discussion last year and I wrote a nodelet hack which automatically redirects such links, so I'm not affected.
But seems like I never published it...
I can do it later if anyone is interested (?)
Cheers Rolf
(addicted to the Perl Programming Language)
| [reply] |
|
| [reply] |
|
<!--
==========================
PM LINK FIXER
==========================
-->
<!--
please disable after successful testing
-->
<h5> Testlinks </h5>
[cpan://Data::Dump] <p>
[mod://Data::Dump] <p>
[http://www.perlmonks.net|www.perlmonks.net] <p>
<script><!--
/*
redirect links
- avoid log out: redirect perlmonks domains to current one!
- cpan -> metacpan
*/
(function (do_log){
var log = function (html){
if (do_log) document.writeln(html);
}
var fixes='';
var doc_host=document.location.hostname;
for (var i in document.links) {
var link_host = document.links[i].hostname;
var link_href = document.links[i].href;
var link_search = document.links[i].pathname;
var link = document.links[i];
/* redirect links from other perlmonks domains to current one! *
+/
if ( link_host &&
link_host != doc_host &&
link_host.match(/^(www\.)?perlmonks.(org|net|com)$/) ) {
fixes += '<li> #'+i+' was '+link_host+'</li>\n';
document.links[i].hostname = doc_host;
}
/* redirect links from cpan to metacpan */
if ( link_host &&
link_host == 'search.cpan.org'
) {
fixes += '<li> #'+i+' fixing '+link.href+'</li>\n';
if ( link.pathname == '/perldoc' ) {
link.hostname = 'metacpan.org';
link.pathname = '/module/'+ link.search.split('?')[1];
link.search='';
link.protocol='https:';
} else if ( link.pathname == '/search' ) {
link.hostname = 'metacpan.org';
link.search='?q'+link.search.split('&query')[1];
}
}
}
if (fixes) {
log('<h5>Fixed Links</h5><small><ol>');
log(fixes);
log('</ol></small>');
}
})(true);
--></script>
Logging and Testlinks should be disabled after successful testing.
Cheers Rolf
(addicted to the Perl Programming Language)
| [reply] [d/l] |
|
> those without accounts can't use it even if they wanted to.
Hmm , actually only those who don't have JS enabled.
The monastery should have a general JS file.
Though I'm not sure about the best way to make it a voluntary feature, maybe with cookies?
update
Please note that this approach fixes ALL links, not only monastery markup but also plain links. Both within posts and chatterbox.
Cheers Rolf
(addicted to the Perl Programming Language)
| [reply] |
Re: Proposal - Update shortcuts pointing to cpan.org to link to mcpan.org
by davido (Cardinal) on Jun 03, 2014 at 19:00 UTC
|
Given that there are shortcuts both for search.cpan.org, and for metacpan.org, I prefer to trust that the author of a node chose the shortcut that he intended to use. Altering shortcuts en masse seems like bulk alteration of authors' semantic intent.
I understand that metacpan.org provides a lot more in the way of nifty-widgets, but its response time also seems slower on average (excluding exceptional events such as downtime). When an author selects a shortcut she or he could be making that intentional decision with a knowledge of each site's advantages and disadvantages.
| [reply] |
|
Please keep in mind that cpan-links are more "handy" which might also explain their popularity.
I can't see the problem to redirect while cpan is down, dead links are not in our interest...
But IMHO the last decision should be done by the reader not the author nor the monastery.
So its rather a question of managing user settings and a global flag.
Cheers Rolf
(addicted to the Perl Programming Language)
| [reply] |
|
+1
I'm inclined to agree with davido on this. I think it's safe to say, Everybody loves choice. Removing/changing en masse i think violates POLA. Ultimately causing unnecessary disappointment.
Do note; I completely understand your bringing this subject up again, marto, and at first, I felt inclined to agree. But after more thought. I think that while seemingly very helpful. Ultimately, maybe not the best solution.
Is it possible to perhaps create a banner on PM. For those days that the search CPAN, starts acting up? Could something like that be done, with relative ease? Or better, does anyone know why this happens so often? Really, with all the Perl people here. Someone must have a bit of insight.
--Chris
¡λɐp ʇɑəɹ⅁ ɐ əʌɐɥ puɐ ʻꜱdləɥ ꜱᴉɥʇ ədoH
| [reply] |
|
| |
|
Thank you for your reply.
Sadly the SiteDocClan didn't have enough foresight to declare in advance that cpan:// links to whatever interface is best to read CPAN, and doc:// links to whatever interface is best to read perldoc. Maybe you're right and this is too late to change now. Next time we add a new shortcut, we should declare this kind of freedom. Afterall, if you want links on a particular website, you could use a direct url.
Update: let me note that my patch would also add new shortcuts to explicitly link to search.cpan.org, namely searchcpan:// searchdist:// searchmod://. I volunteer to document these changes to What shortcuts can I use for linking to other information? and How do I link to modules on CPAN? if the patch is applied.
| [reply] |
Re: Proposal - Update shortcuts pointing to cpan.org to link to mcpan.org
by tangent (Parson) on Jun 03, 2014 at 21:34 UTC
|
Might be a bit clumsy but could there be a [metacpan] next to each link. Personally I much prefer the metacpan pages. | [reply] |
|
Personally, I like the idea of having a primary link to CPAN and secondary link to metaCPAN. I might be old-fashioned and prefer CPAN, but I admit that the recent amount of downtime for CPAN is annoying.
You must always remember that the primary goal is to drain the swamp even when you are hip-deep in alligators.
| [reply] |
|
| [reply] |
Re: Proposal - Update shortcuts pointing to cpan.org to link to mcpan.org
by Anonymous Monk on Jun 03, 2014 at 23:56 UTC
|
| [reply] |
|
> but I doubt it takes into anchors, and the anchors between metacpan.org and search.cpan.org aren't portable
Why exactly are deep links not portable?
For example this CONFIGURATION of Data::Dump translates w/o problems.
Please elaborate further!
Cheers Rolf
(addicted to the Perl Programming Language)
| [reply] |
|
(?|pattern)
(?|pattern) [href://http://search.cpan.org/perldoc/perlre#%28?%7cpattern%29|(?|pat
+tern)]
[href://https://metacpan.org/pod/perlre#pattern1|(?|pattern)]
Its pod-literalish link versus transformed-for-some-rfc-email
Built-in linkrot is weak ... with that keyword another example Re: Linking from POD (artificial linkrot, Pod::Simple::XHTML bugs)
Breaking your own links because new version came out is weak
Having to UTSL of a webpage to figure out anchor/id is weak (could be considered a browser problem , which a bookmarklet could remedy, but copy/paste should suffice)
| [reply] [d/l] |
|