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

Pkg block syntax support #5

Merged
merged 3 commits into from Oct 27, 2014
Merged

Conversation

kentfredric
Copy link
Contributor

This patchset, amongst other things, adds better support for v5.14+

package Foo { 
   # body
}
1;

Style notation.
As-is, it erroneously places the AUTHORITY declaration after the 1 at the end, like so:

package Foo {  
   # body
}
1;
BEGIN { 
   $Foo::AUTHORITY = 'cpan:kentnl';
}

Which is rather bad, and the augmented code now instead does:

package Foo {
BEGIN { 
   $Foo::AUTHORITY = 'cpan:kentnl';
}

   # body
}
1;

In the process of doing so, I incidentally discovered the code that inserted the our $AUTHORITY stanzas caused Authority.pm to self-positive when scanning itself:

[DZ] beginning to build Dist-Zilla-Plugin-Authority
[@Filter/Git::NextVersion] Bumping version from 1.006 to 1.007
[DZ] guessing dist's main_module is lib/Dist/Zilla/Plugin/Authority.pm
[DZ] extracting distribution abstract from lib/Dist/Zilla/Plugin/Authority.pm
[@Filter/Authority] skipping lib/Dist/Zilla/Plugin/Authority.pm: assigns to $AUTHORITY ## <---
[DZ] writing Dist-Zilla-Plugin-Authority in Dist-Zilla-Plugin-Authority-1.007
[DZ] building archive with Archive::Tar; install Archive::Tar::Wrapper for improved speed
[DZ] writing archive to Dist-Zilla-Plugin-Authority-1.007.tar.gz

And additionally, the code was a little hard to parse as to what was doing what, so I refactored the hell out of it, and it now uses templates ( sprintf ) to avoid detection instead of a silly \x20 hack.

I also in my travels noticed the code has several indentation styles, and could much do with a bundled .perltidyrc file that can be gauranteed upon, but have left my already-tided form of the same in a seperate branch.

@apocalypse
Copy link
Owner

Thanks very much for this! I liked the way you worked around the \x20 hack :)

apocalypse added a commit that referenced this pull request Oct 27, 2014
@apocalypse apocalypse merged commit fbd1745 into apocalypse:master Oct 27, 2014
apocalypse referenced this pull request in karenetheridge/Dist-Zilla-Plugin-Authority Oct 27, 2014
This makes both code paths insert identical code, and also eliminates the
"used only once" warning that arises from "perl lib/Foo.pm".
apocalypse pushed a commit that referenced this pull request Oct 27, 2014
	Rewrote how we assign the $AUTHORITY variable to use 'our' instead of the crufty pkg declaration format via gh-5 and gh-6 and RT#86611 ( thanks KENTNL + ETHER )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants