pause icon indicating copy to clipboard operation
pause copied to clipboard

be stricter in when finding packages in files

Open rjbs opened this issue 10 years ago • 7 comments

This will prevent us from finding a package in this line of code:

my $x = "package Foo;";

This manifested in the wild in PRBRENAN/Math-Algebra-Symbols-1.21.tar.gz

rjbs avatar May 08 '15 02:05 rjbs

We discussed this in Berlin, and the concern is that it cause changes to old behavior. I began a process of re-indexing all of CPAN, but it was clearly going to take a CPU-week.

My next idea is to search for distributions with lines matching one regex and not the other, then inspect those specifically.

rjbs avatar May 08 '15 02:05 rjbs

I've got a job running now, but I need to go to bed. In the morning I'll put the results in a commit on this branch. They are quite interesting so far!

rjbs avatar May 08 '15 03:05 rjbs

So! I pushed the report file after making a few changes after the first run.

The fields are: filename, line number, matched by old regex?, matched by new regex? I didn't log the dist file, oops! I think we're okay without it for now.

The great majority of changes seem to be packages in strings, sometimes being eval'd. Plenty of them, though, are just lines containing things like $name = "the package Foo";

Other interesting constructs that this change would stop indexing include:

  • map {; package XYZ; ... }
  • do { package XYZ; ...
  • my $code = sub { package XYZ; ... };

I think this change is worth making, but I cede that it is at least not clear.

rjbs avatar May 08 '15 12:05 rjbs

All of these code snippets need to be added to Module::Metadata's test corpus. As far as I know it's still in our long term plans to cut PAUSE over to using Module::Metadata.

(@rjbs: please feed me a list when available and I'll add them, adding TODO markers as needed.)

karenetheridge avatar May 08 '15 16:05 karenetheridge

Is the list in the "report file" linked to above sufficient? (If not, why not?)

rjbs avatar May 23 '15 13:05 rjbs

I'm removing the report file from the PR and attaching it here.

rjbs avatar Apr 28 '23 11:04 rjbs

cf. https://github.com/charsbar/Parse-PMFile/commit/53729d72eae3015298a858d46afda3529d40881c

charsbar avatar Apr 21 '24 08:04 charsbar

Thanks, applied, and deployed just now.

andk avatar Apr 25 '24 15:04 andk