Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sysread/dist-zilla-plugin-xsversion
Adds XS_VERSION and munges XSLoader::load for perl XS modules using Dist::Zilla
https://github.com/sysread/dist-zilla-plugin-xsversion
Last synced: about 2 months ago
JSON representation
Adds XS_VERSION and munges XSLoader::load for perl XS modules using Dist::Zilla
- Host: GitHub
- URL: https://github.com/sysread/dist-zilla-plugin-xsversion
- Owner: sysread
- Created: 2018-06-29T19:02:53.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-06-29T19:40:14.000Z (over 6 years ago)
- Last Synced: 2023-08-20T22:52:22.044Z (over 1 year ago)
- Language: Perl
- Size: 2.93 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.pod
- Changelog: Changes
Awesome Lists containing this project
README
=pod
=encoding UTF-8
=head1 NAME
Dist::Zilla::Plugin::XSVersion - a thing
=head1 VERSION
version 0.01
=head1 SYNOPSIS
# dist.ini
[XSVersion]# MyModule.pm
package MyModule;require XSLoader;
XSLoader::load('MyModule');=head1 DESCRIPTION
A hackey, quick plugin to implement the commonly used $XS_VERSION pattern
required in order to support XS-loading of trial releases. This is not
possible using L, which will generate
something like:$MyModule::VERSION = '0.123_1'; # first line for CPAN indexer
$MyModule::VERSION = '0.1231'; # next line for internal versioningWithout an explicit second argument, L will attempt to load the
compiled module using a C against the value of
C<$MyModule::VERSION>, which no longer matches C<0.123_1> after being
overwritten.$MyModule::VERSION = '0.123_1'; # first line for CPAN indexer
$MyModule::VERSION = '0.1231'; # next line for internal versioning
XSLoader::load('MyModule'); # gets the wrong $VERSIONThis plugin rewrites the code above to something like:
$MyModule::XS_VERSION = $MyModule::VERSION = '0.123_1';
$MyModule::VERSION = '0.1231';
XSLoader::load('MyModule', $MyModule::XS_VERSION);=head1 CAVEATS
I have no patience for PPI, so instead I fudged it with a couple of quick
regexes. So long as you are using C to add $VERSION and do not do
anything fancy on your C line (such as load the result of
evaluating an expression), everything should work. If not... well,
I.=head1 AUTHOR
Jeff Ober
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2018 by Jeff Ober.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.=cut