Block package statements aren't parsed #49

Open
tsibley opened this Issue May 15, 2013 · 3 comments

Comments

Projects
None yet
3 participants
@tsibley

tsibley commented May 15, 2013

Statements like the following aren't properly parsed:

package Foo::Bar {
     …
}

Because of a quirk of the regex, specifying a version like the below does work:

package Foo::Bar 0.01 {
     …
}

BUT, the version you specify isn't picked up if there's a $VERSION declaration elsewhere in the file (even in a different package). See TSIBLEY/CPAN-Test-Dummy-Perl5-PackageWithBlock-0.01 and -0.03 for an example. The emails showing the incorrect index results are below.

The following report has been written by the PAUSE namespace indexer.
  Please contact modules@perl.org if there are any open questions.

  User: TSIBLEY (Thomas Sibley)
  Distribution file: CPAN-Test-Dummy-Perl5-PackageWithBlock-0.01.tar.gz
  Number of files: 12
  *.pm files: 1
  README: CPAN-Test-Dummy-Perl5-PackageWithBlock-0.01/README
  META-File: CPAN-Test-Dummy-Perl5-PackageWithBlock-0.01/META.json
  META-Parser: Parse::CPAN::Meta 1.4404
  META-driven index: no
  Timestamp of file: Wed May  8 21:05:20 2013 UTC
  Time of this run: Wed May  8 21:06:57 2013 UTC

Status of this distro: OK
=========================

The following packages (grouped by status) have been found in the distro:

Status: Successfully indexed
          ============================

     module: CPAN::Test::Dummy::Perl5::PackageWithBlock::AndVersion
          version: 0.01
          in file: CPAN-Test-Dummy-Perl5-PackageWithBlock-0.01/lib/CPAN/Test/Dummy/Perl5/PackageWithBlock.pm
          status: indexed

__END__
The following report has been written by the PAUSE namespace indexer.
  Please contact modules@perl.org if there are any open questions.

  User: TSIBLEY (Thomas Sibley)
  Distribution file: CPAN-Test-Dummy-Perl5-PackageWithBlock-0.03.tar.gz
  Number of files: 12
  *.pm files: 1
  README: CPAN-Test-Dummy-Perl5-PackageWithBlock-0.03/README
  META-File: CPAN-Test-Dummy-Perl5-PackageWithBlock-0.03/META.json
  META-Parser: Parse::CPAN::Meta 1.4404
  META-driven index: no
  Timestamp of file: Wed May  8 21:20:29 2013 UTC
  Time of this run: Wed May  8 21:22:11 2013 UTC

Status of this distro: OK
=========================

The following packages (grouped by status) have been found in the distro:

Status: Successfully indexed
          ============================

     module: CPAN::Test::Dummy::Perl5::PackageWithBlock::AndVersion
          version: 0.03
          in file: CPAN-Test-Dummy-Perl5-PackageWithBlock-0.03/lib/CPAN/Test/Dummy/Perl5/PackageWithBlock.pm
          status: indexed

__END__
@rjbs

This comment has been minimized.

Show comment
Hide comment
@rjbs

rjbs Mar 16, 2014

Collaborator

I believe this was fixed yesterday. I will add a test.

Collaborator

rjbs commented Mar 16, 2014

I believe this was fixed yesterday. I will add a test.

@karenetheridge

This comment has been minimized.

Show comment
Hide comment
@karenetheridge

karenetheridge Mar 16, 2014

Contributor

I believe Module::Metadata already understands this syntax, but I will fix if it does not.

Contributor

karenetheridge commented Mar 16, 2014

I believe Module::Metadata already understands this syntax, but I will fix if it does not.

@rjbs

This comment has been minimized.

Show comment
Hide comment
@rjbs

rjbs Mar 16, 2014

Collaborator

package NAME BLOCK now works, but neither package NAME VERSION nor package NAME VERSION BLOCK has its version correctly detected. I have begun work on this at rjbs/pkg-name

Collaborator

rjbs commented Mar 16, 2014

package NAME BLOCK now works, but neither package NAME VERSION nor package NAME VERSION BLOCK has its version correctly detected. I have begun work on this at rjbs/pkg-name

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment