From 748562206512733f44b44885a4bc902dc2ccb707 Mon Sep 17 00:00:00 2001 From: Kenichi Ishigaki Date: Fri, 24 Apr 2026 00:52:01 +0900 Subject: [PATCH 1/2] Let pmfile recognize class attributes --- lib/PAUSE/pmfile.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/PAUSE/pmfile.pm b/lib/PAUSE/pmfile.pm index 8c20212a..742e9f2e 100644 --- a/lib/PAUSE/pmfile.pm +++ b/lib/PAUSE/pmfile.pm @@ -260,7 +260,7 @@ sub packages_per_pmfile { \b(?:$package_or_class)\s+ ([\w\:\']+) \s* - (?: $ | [\}\;] | \{ | \s+($version::STRICT) ) + (?: $ | [\}\;\:] | \{ | \s+($version::STRICT) ) }x) { $pkg = $1; $strict_version = $2; @@ -390,7 +390,7 @@ sub packages_per_pmfile { $package_or_class = 'package|class|role'; } - if (my ($ver) = /^[\s\{;]*(?:$package_or_class) \s+ \S+ \s+ (\S+) \s* [;{]/x) { + if (my ($ver) = /^[\s\{;]*(?:$package_or_class) \s+ \S+ \s+ (\S+) \s* [:;{]/x) { # XXX: should handle this better if version is bogus -- rjbs, # 2014-03-16 return $ver if version::is_lax($ver); From 7f43ffb9fee463360bae622ee807282879dc8381 Mon Sep 17 00:00:00 2001 From: Kenichi Ishigaki Date: Fri, 24 Apr 2026 00:52:26 +0900 Subject: [PATCH 2/2] Update a test --- t/mldistwatch-class.t | 87 +++++++++++++++++++++++++++++++------------ 1 file changed, 63 insertions(+), 24 deletions(-) diff --git a/t/mldistwatch-class.t b/t/mldistwatch-class.t index 08999414..ce13d92c 100644 --- a/t/mldistwatch-class.t +++ b/t/mldistwatch-class.t @@ -175,6 +175,17 @@ use builtin qw( true false trim ); class Test::ClassBlock { } +EOT + }, + { + file => "lib/Test/ClassBlockAttr.pm", + content => <<"EOT", +use v5.37.9; +$test->[1] +use builtin qw( true false trim ); + +class Test::ClassBlockAttr :isa(Test::ClassBlock) { +} EOT }, { @@ -185,6 +196,16 @@ $test->[1] use builtin qw( true false trim ); class Test::ClassVersion 0.01; +EOT + }, + { + file => "lib/Test/ClassVersionAttr.pm", + content => <<"EOT", +use v5.37.9; +$test->[1] +use builtin qw( true false trim ); + +class Test::ClassVersionAttr 0.01 :isa(Test::ClassVersion); EOT }, { @@ -207,6 +228,17 @@ use builtin qw( true false trim ); class Test::ClassVersionBlock 0.03 { } +EOT + }, + { + file => "lib/Test/ClassVersionBlockAttr.pm", + content => <<"EOT", +use v5.37.9; +$test->[1] +use builtin qw( true false trim ); + +class Test::ClassVersionBlockAttr 0.04 :isa(Test::ClassVersionBlock) { +} EOT }, { @@ -292,33 +324,40 @@ EOT my $result = $pause->test_reindex; $result->package_list_ok([ - { package => 'Test::Class', version => 'undef' }, - { package => 'Test::ClassBlock', version => 'undef' }, - { package => 'Test::ClassBlockOurVersion', version => '0.04' }, - { package => 'Test::ClassOurVersion', version => '0.02' }, - { package => 'Test::ClassVersion', version => '0.01' }, - { package => 'Test::ClassVersionBlock', version => '0.03' }, - { package => 'Test::Role', version => 'undef' }, - { package => 'Test::RoleBlock', version => 'undef' }, - { package => 'Test::RoleBlockOurVersion', version => '0.04' }, - { package => 'Test::RoleOurVersion', version => '0.02' }, - { package => 'Test::RoleVersion', version => '0.01' }, - { package => 'Test::RoleVersionBlock', version => '0.03' }, + { package => 'Test::Class', version => 'undef' }, + { package => 'Test::ClassBlock', version => 'undef' }, + { package => 'Test::ClassBlockAttr', version => 'undef' }, + { package => 'Test::ClassBlockOurVersion', version => '0.04' }, + { package => 'Test::ClassOurVersion', version => '0.02' }, + { package => 'Test::ClassVersion', version => '0.01' }, + { package => 'Test::ClassVersionAttr', version => '0.01' }, + { package => 'Test::ClassVersionBlock', version => '0.03' }, + { package => 'Test::ClassVersionBlockAttr', version => '0.04' }, + { package => 'Test::Role', version => 'undef' }, + { package => 'Test::RoleBlock', version => 'undef' }, + { package => 'Test::RoleBlockOurVersion', version => '0.04' }, + { package => 'Test::RoleOurVersion', version => '0.02' }, + { package => 'Test::RoleVersion', version => '0.01' }, + { package => 'Test::RoleVersionBlock', version => '0.03' }, ]); $result->perm_list_ok({ - 'Test::Class' => { f => 'SOMEONE' }, - 'Test::ClassBlock' => { f => 'SOMEONE' }, - 'Test::ClassVersion' => { f => 'SOMEONE' }, - 'Test::ClassOurVersion' => { f => 'SOMEONE' }, - 'Test::ClassVersionBlock' => { f => 'SOMEONE' }, - 'Test::ClassBlockOurVersion' => { f => 'SOMEONE' }, - 'Test::Role' => { f => 'SOMEONE' }, - 'Test::RoleBlock' => { f => 'SOMEONE' }, - 'Test::RoleVersion' => { f => 'SOMEONE' }, - 'Test::RoleOurVersion' => { f => 'SOMEONE' }, - 'Test::RoleVersionBlock' => { f => 'SOMEONE' }, - 'Test::RoleBlockOurVersion' => { f => 'SOMEONE' }, + 'Test::Class' => { f => 'SOMEONE' }, + 'Test::ClassBlock' => { f => 'SOMEONE' }, + 'Test::ClassBlockAttr' => { f => 'SOMEONE' }, + 'Test::ClassVersion' => { f => 'SOMEONE' }, + 'Test::ClassVersionAttr' => { f => 'SOMEONE' }, + 'Test::ClassOurVersion' => { f => 'SOMEONE' }, + 'Test::ClassOurVersion' => { f => 'SOMEONE' }, + 'Test::ClassVersionBlock' => { f => 'SOMEONE' }, + 'Test::ClassVersionBlockAttr' => { f => 'SOMEONE' }, + 'Test::ClassBlockOurVersion' => { f => 'SOMEONE' }, + 'Test::Role' => { f => 'SOMEONE' }, + 'Test::RoleBlock' => { f => 'SOMEONE' }, + 'Test::RoleVersion' => { f => 'SOMEONE' }, + 'Test::RoleOurVersion' => { f => 'SOMEONE' }, + 'Test::RoleVersionBlock' => { f => 'SOMEONE' }, + 'Test::RoleBlockOurVersion' => { f => 'SOMEONE' }, }); }; }