-
Notifications
You must be signed in to change notification settings - Fork 576
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add private packages to no_index metadata #1380
Conversation
Calling for a vote from @mojolicious/core to gauge interest. |
I think this is the most indifferent i have ever felt about a patch. 😐 |
Asking just so I understand: is this change proposed because CPAN can (or won't?) skip indexing |
Correct, PAUSE currently does not care about _ prefixes on package names. |
The alternative approach does seem workable with perltidy, so it is opened at #1381 |
After #1381, i suddenly feel much less indifferent about this one. 🤣 |
From what I have understood so far the situation is this:
Given the above I would rather see the changes in the Makefile.PL if I had to choose, but overall I am 👎 to this change as I do not see why indexing |
It's not an explicit problem. It (being indexed on CPAN) could be considered an implicit indication that these packages can be used or depended on, which is not the case. |
If you have any secondary packages within an actual module, you do not want to index those modules as you would not be able to use them directly from any application. So, it's best practice to hide inner packages/classes from PAUSE so that people don't try to do the wrong thing. package Foo;
use strict;
{
package Foo::Inner;
use strict;
sub whatever { return 42 }
}
sub new {
my $self = bless {}, shift;
$self->{_something} = "bar";
return $self;
}
sub foo { return Foo::Inner::whatever }
1; Now, in a script, I should be able to find #!/usr/bin/env perl
use strict;
use warnings;
use Foo;
my $foo = Foo->new();
print $foo->foo; # yay #!/usr/bin/env perl
use strict;
use warnings;
use Foo::Inner; # kaboom
print Foo::Inner::whatever; Since PAUSE will index that by default, it will show up as something shipped in your distribution. You should hide these from PAUSE so people aren't going to try that second script example. package # hide from PAUSE
Foo::Inner; |
Note that #1381 will additionally hide the packages from the metacpan release page, while this PR will not. |
Thank you for a good example. That helped my understanding. Considering the example I'm neutral to this change as this does not require changes to code like shown in #1381 . |
Summary
Prevent private packages from being indexed.
Motivation
Packages starting with _ are not intended to be externally used or depended on, so they have no reason to be indexed on CPAN.
An alternative method is to put a newline after the 'package' keyword so PAUSE will ignore these packages, but this requires an exception for perltidy.