pause icon indicating copy to clipboard operation
pause copied to clipboard

Get a version from `(class|role) NAME VERSION` line

Open charsbar opened this issue 2 years ago • 5 comments

Since Perl 5.37.9, class NAME VERSION is a valid native class declaration. So it would be nice for PAUSE to get a version from the line. Also, role NAME VERSION would be available eventually (considering Object::Pad has that).

The change should be the following but we need to discuss what should be supported first, as it may be too early because other tools like ExtUtils::MakeMaker don't get a version from the line.

diff --git a/lib/PAUSE/pmfile.pm b/lib/PAUSE/pmfile.pm
index a637e04..374778e 100644
--- a/lib/PAUSE/pmfile.pm
+++ b/lib/PAUSE/pmfile.pm
@@ -227,7 +227,7 @@ sub packages_per_pmfile {
             $pline =~ m{
                       (.*)
                       (?<![*\$\\@%&]) # no sigils
-                      \bpackage\s+
+                      \b(?:package|class|role)\s+
                       ([\w\:\']+)
                       \s*
                       (?: $ | [\}\;] | \{ | \s+($version::STRICT) )

charsbar avatar Apr 27 '23 12:04 charsbar

The change should be the following but we need to discuss what should be supported first, as it may be too early because other tools like ExtUtils::MakeMaker don't get a version from the line.

I will look at supporting class in EUMM, Parse::PMFile and Module::Metadata at PTS 2023.

karenetheridge avatar Apr 27 '23 13:04 karenetheridge

@karenetheridge FYI, I've already shipped Parse::PMFile 0.44 with class support :)

charsbar avatar Apr 27 '23 13:04 charsbar

You are too fast! :)

karenetheridge avatar Apr 27 '23 14:04 karenetheridge

Support for testing this improved by https://github.com/rjbs/Module-Faker/commit/f24b38f4ebc9b4d9cf51504c3032dd40c3eb43c5

rjbs avatar Apr 28 '23 10:04 rjbs

cf. https://github.com/andk/pause/issues/436

charsbar avatar Mar 21 '24 12:03 charsbar

cf. https://github.com/charsbar/Parse-PMFile/pull/15/files

charsbar avatar Apr 21 '24 10:04 charsbar

We believe this is superceded by #447 and DONE

andk avatar Apr 26 '24 15:04 andk