GithubHelp home page GithubHelp logo

dist-zilla-plugin-xsversion's Introduction

NAME

Dist::Zilla::Plugin::XSVersion - a thing

VERSION

version 0.01

SYNOPSIS

# dist.ini
[XSVersion]

# MyModule.pm
package MyModule;

require XSLoader;
XSLoader::load('MyModule');

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 Dist::Zilla::Plugin::PkgVersion, which will generate something like:

$MyModule::VERSION = '0.123_1'; # first line for CPAN indexer
$MyModule::VERSION = '0.1231';  # next line for internal versioning

Without an explicit second argument, "load" in XSLoader will attempt to load the compiled module using a VERSIONCHECK against the value of $MyModule::VERSION, which no longer matches 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 $VERSION

This 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);

CAVEATS

I have no patience for PPI, so instead I fudged it with a couple of quick regexes. So long as you are using PkgVersion to add $VERSION and do not do anything fancy on your XSLoader::load line (such as load the result of evaluating an expression), everything should work. If not... well, patches welcome.

AUTHOR

Jeff Ober <[email protected]>

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.

dist-zilla-plugin-xsversion's People

Contributors

sysread avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.