Skip to content
This repository has been archived by the owner on Mar 7, 2019. It is now read-only.

Commit

Permalink
New interpolation: %x --> $^X (current Perl interpreter)
Browse files Browse the repository at this point in the history
  • Loading branch information
jberger committed May 2, 2012
1 parent 67cf74a commit a6f4a4a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Changes
@@ -1,5 +1,8 @@
Revision history for Perl module Alien::Base. Revision history for Perl module Alien::Base.


0.000_015
- interpolation %x is current Perl interpreter ($^X)

0.000_014 May 1, 2012 0.000_014 May 1, 2012
- bugfix on dontpanic build chain (t/zz-example.t) - bugfix on dontpanic build chain (t/zz-example.t)


Expand Down
2 changes: 2 additions & 0 deletions lib/Alien/Base/ModuleBuild.pm
Expand Up @@ -384,6 +384,8 @@ sub alien_interpolate {
$string =~ s/(?<!\%)\%p/$prefix/g; $string =~ s/(?<!\%)\%p/$prefix/g;
# library name (ph: %n) # library name (ph: %n)
$string =~ s/(?<!\%)\%n/$name/g; $string =~ s/(?<!\%)\%n/$name/g;
# current interpreter ($^X) (ph: %x)
$string =~ s/(?<!\%)\%x/$^X/g;


#remove escapes (%%) #remove escapes (%%)
$string =~ s/\%(?=\%)//g; $string =~ s/\%(?=\%)//g;
Expand Down
4 changes: 4 additions & 0 deletions lib/Alien/Base/ModuleBuild/API.pod
Expand Up @@ -188,6 +188,10 @@ Shortcut for the name stored in C<alien_name>


pkg-config --modversion %n pkg-config --modversion %n


=item %x

The current Perl interpreter (aka $^X)

=item %% =item %%


A literal C<%>. A literal C<%>.
Expand Down
2 changes: 2 additions & 0 deletions t/interpolate.t
Expand Up @@ -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=$path", 'share_dir interpolation');
is( $builder->alien_interpolate('thing other=%%s'), 'thing other=%s', 'no share_dir interpolation with escape'); 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; done_testing;


0 comments on commit a6f4a4a

Please sign in to comment.