/module/<mod-name> should perhaps be /module/<dist-name>/<mod-name> #247

Closed
perlancar opened this Issue Aug 18, 2011 · 6 comments

Comments

Projects
None yet
6 participants
@perlancar

PAUSE allows two separate distributions (from the same maintainer or two different maintainers) to contain module with the same name, for example:

SHARYANTO-Dummy-Dist1, SHARYANTO-Dummy-Dist2, and LYUMING-Dummy-Dist3 each contains this module: SHARYANTO-Dummy-Module1.

metacpan.org should allow looking into each of these modules. Right now:

https://metacpan.org/module/SHARYANTO::Dummy::Module1 points to module contained in LYUMING-Dummy-Dist3. It is not possible to see SHARYANTO-Dummy-Dist1's or SHARYANTO-Dummy-Dist2's version of that module.

@perlancar

This comment has been minimized.

Show comment Hide comment
@perlancar

perlancar Aug 18, 2011

To better keep backward compatibility, there are some other choices:

/module/$mod-name/$dist-name
/dist/$dist-name/module/$mod-name
/moduledist/$mod-name/$dist-name

To better keep backward compatibility, there are some other choices:

/module/$mod-name/$dist-name
/dist/$dist-name/module/$mod-name
/moduledist/$mod-name/$dist-name

@monken

This comment has been minimized.

Show comment Hide comment
@monken

monken Aug 18, 2011

Member

We want pages to build up good ranking on google and other search engines. In order to achieve that we make the url as short as possible. We also don't want the URL to change to something else when the module is moved to another distribution. You can always access a module of you know which release it belongs to, e.g. https://metacpan.org/release/SHARYANTO/SHARYANTO-Dummy-Dist2-0.01

Member

monken commented Aug 18, 2011

We want pages to build up good ranking on google and other search engines. In order to achieve that we make the url as short as possible. We also don't want the URL to change to something else when the module is moved to another distribution. You can always access a module of you know which release it belongs to, e.g. https://metacpan.org/release/SHARYANTO/SHARYANTO-Dummy-Dist2-0.01

@timbunce

This comment has been minimized.

Show comment Hide comment
@timbunce

timbunce Aug 18, 2011

The module/ url namespace should be reserved for whichever instance of the module is currently indexed (i.e., in 02packages). That's an important role. It's unfortunate that it currently serves two distinct roles:

https://metacpan.org/module/DBI
https://metacpan.org/module/TIMB/DBI-1.612_90/DBI.pm

I'd rather the second url had a different root. Let's not muddy the water further.

Doing a search for SHARYANTO::Dummy::Module1 using https://metacpan.org/search?q=SHARYANTO%3A%3ADummy%3A%3AModule1 does show the three distinct releases.

The bug here is in how modules in search results are mapped to links.

All three results have the module name linked to https://metacpan.org/module/$module
Only the specific instance of the module that's currently indexed (in 02packages) should have that link.
The other results should go to module/$auth/$dist/$mod-path.pm

This bug exists in multiple places across the site. For example, looking back at the search results for SHARYANTO::Dummy::Module1 there are three releases listed. Clicking on each of them will show a page that lists the modules in the release. That page links to https://metacpan.org/module/$module but should link to module/$auth/$dist/$mod-path.pm instead.

I'm not familiar with the code but I'd suggest that there needs to be a method that returns the url for a module:

$url = $obj->url_for_module($release, $module_name, $ignore_index_status);

If $ignore_index_status is true then it'll always return a module/$auth/$dist/$mod-path.pm url.
If $ignore_index_status is false then it'll check if that module in that release is currently in the index.
If so it'll return module/$module instead.

The module/ url namespace should be reserved for whichever instance of the module is currently indexed (i.e., in 02packages). That's an important role. It's unfortunate that it currently serves two distinct roles:

https://metacpan.org/module/DBI
https://metacpan.org/module/TIMB/DBI-1.612_90/DBI.pm

I'd rather the second url had a different root. Let's not muddy the water further.

Doing a search for SHARYANTO::Dummy::Module1 using https://metacpan.org/search?q=SHARYANTO%3A%3ADummy%3A%3AModule1 does show the three distinct releases.

The bug here is in how modules in search results are mapped to links.

All three results have the module name linked to https://metacpan.org/module/$module
Only the specific instance of the module that's currently indexed (in 02packages) should have that link.
The other results should go to module/$auth/$dist/$mod-path.pm

This bug exists in multiple places across the site. For example, looking back at the search results for SHARYANTO::Dummy::Module1 there are three releases listed. Clicking on each of them will show a page that lists the modules in the release. That page links to https://metacpan.org/module/$module but should link to module/$auth/$dist/$mod-path.pm instead.

I'm not familiar with the code but I'd suggest that there needs to be a method that returns the url for a module:

$url = $obj->url_for_module($release, $module_name, $ignore_index_status);

If $ignore_index_status is true then it'll always return a module/$auth/$dist/$mod-path.pm url.
If $ignore_index_status is false then it'll check if that module in that release is currently in the index.
If so it'll return module/$module instead.

@garu

This comment has been minimized.

Show comment Hide comment
@garu

garu Aug 22, 2011

Contributor

I just got bit by this!

If you fire up https://metacpan.org/release/Perl-Critic-More you'll see a TODO link right under "documentation", but clicking on it actually opens https://metacpan.org/module/TODO which is definitely not the file I was looking for :)

While I agree that urls should be as short as possible, I also agree with Tim that "the bug here is in how modules in search results are mapped to links".

Contributor

garu commented Aug 22, 2011

I just got bit by this!

If you fire up https://metacpan.org/release/Perl-Critic-More you'll see a TODO link right under "documentation", but clicking on it actually opens https://metacpan.org/module/TODO which is definitely not the file I was looking for :)

While I agree that urls should be as short as possible, I also agree with Tim that "the bug here is in how modules in search results are mapped to links".

@omega

This comment has been minimized.

Show comment Hide comment
@omega

omega Aug 20, 2013

Contributor

This relates to #176 I think? Is it a duplicate?

Contributor

omega commented Aug 20, 2013

This relates to #176 I think? Is it a duplicate?

@ranguard

This comment has been minimized.

Show comment Hide comment
@ranguard

ranguard Dec 21, 2013

Member

This has all changed recently - so might be clearer now

Member

ranguard commented Dec 21, 2013

This has all changed recently - so might be clearer now

@ranguard ranguard closed this Dec 21, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment