Permalink
Browse files

New interpolation: %x --> $^X (current Perl interpreter)

  • Loading branch information...
1 parent 67cf74a commit a6f4a4a6095f44c0af184aac87106f7887823ebb @jberger jberger committed May 2, 2012
Showing with 11 additions and 0 deletions.
  1. +3 −0 Changes
  2. +2 −0 lib/Alien/Base/ModuleBuild.pm
  3. +4 −0 lib/Alien/Base/ModuleBuild/API.pod
  4. +2 −0 t/interpolate.t
View
3 Changes
@@ -1,5 +1,8 @@
Revision history for Perl module Alien::Base.
+0.000_015
+ - interpolation %x is current Perl interpreter ($^X)
+
0.000_014 May 1, 2012
- bugfix on dontpanic build chain (t/zz-example.t)
View
2 lib/Alien/Base/ModuleBuild.pm
@@ -384,6 +384,8 @@ sub alien_interpolate {
$string =~ s/(?<!\%)\%p/$prefix/g;
# library name (ph: %n)
$string =~ s/(?<!\%)\%n/$name/g;
+ # current interpreter ($^X) (ph: %x)
+ $string =~ s/(?<!\%)\%x/$^X/g;
#remove escapes (%%)
$string =~ s/\%(?=\%)//g;
View
4 lib/Alien/Base/ModuleBuild/API.pod
@@ -188,6 +188,10 @@ Shortcut for the name stored in C<alien_name>
pkg-config --modversion %n
+=item %x
+
+The current Perl interpreter (aka $^X)
+
=item %%
A literal C<%>.
View
2 t/interpolate.t
@@ -18,5 +18,7 @@ my $path = rel2abs "_install";
is( $builder->alien_interpolate('thing other=%s'), "thing other=$path", 'share_dir interpolation');
is( $builder->alien_interpolate('thing other=%%s'), 'thing other=%s', 'no share_dir interpolation with escape');
+is( $builder->alien_interpolate('%x'), "$^X", '%x is current interpreter' );
+
done_testing;

0 comments on commit a6f4a4a

Please sign in to comment.