Skip to content
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

Respect class/role if the PAUSE finds a few modules are used in the pacakge file #447

Closed
wants to merge 5 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions lib/PAUSE/pmfile.pm
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ sub packages_per_pmfile {
my $inpod = 0;

my $checked_bom;
my $package_or_class = 'package';
PLINE: while (<$fh>) {
chomp;
my($pline) = $_;
Expand All @@ -225,15 +226,38 @@ sub packages_per_pmfile {
last PLINE;
}

=pod
# hide in the pod block until 'class' is added to a version bundle
if ($pline =~ /^[\s\{;]*use\s(+v?5\.[0-9]+)/) {
my $version = $1;
my $version_bundle_for_class = version->parse("v5.xx.xx");
if (eval { version->parse($version) >= $version_bundle_for_class) {
$package_or_class = 'package|class|role';
}
next PLINE;
}
=cut

# use feature 'class'; enabels class (and role, though not implemented yet)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type in comment: should be enables

if ($pline =~ /^[\s\{;]*use\s+(?:feature|experimental)\s+[^;]+\b(?:class|all)[^;]*;/) {
$package_or_class = 'package|class';
}
if ($pline =~ /^[\s\{;]*use\s+(?:Feature::Compat::Class)[^;]*;/) {
$package_or_class = 'package|class';
}
# Object::Pad is special-cased; let's ignore other modules that are too old or less known
if ($pline =~ /^[\s\{;]*use\s+(?:Object::Pad)[^;]*;/) {
$package_or_class = 'package|class|role';
}

my $pkg;
my $strict_version;

if (
$pline =~ m{
^
[\s\{;]*
package
\s+
\b(?:$package_or_class)\s+
([\w\:\']+)
\s*
(?: $ | [\}\;] | \{ | \s+($version::STRICT) )
Expand Down
Loading