Dist-Zilla-Plugin-XSVersion

 view release on metacpan or  search on metacpan

lib/Dist/Zilla/Plugin/XSVersion.pm  view on Meta::CPAN

use strict;
use warnings;
use Moose;

with 'Dist::Zilla::Role::FileMunger';

sub munge_file {
  my ($self, $file) = @_;
  return unless $file->name =~ /\.pm$/;
  my $perl = $file->content;
  my ($line, $module) = $perl =~ /((\$[\w:]+?::)VERSION.+?;)/;
  $perl =~ s/((\$[\w:]+?::)VERSION.+?;)/$2XS_VERSION = $1/;
  $perl =~ s/XSLoader::load\(([^)]+)\)/XSLoader::load($1, ${module}XS_VERSION)/;
  $file->content($perl);
}

__PACKAGE__->meta->make_immutable;

1;

__END__



( run in 0.221 second using v1.01-cache-2.11-cpan-b61123c0432 )