/usr/share/perl5/Module/Install/DSL.pm is in libmodule-install-perl 1.19-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | package Module::Install::DSL;
use strict;
use vars qw{$VERSION $ISCORE};
BEGIN {
$VERSION = '1.19';
$ISCORE = 1;
*inc::Module::Install::DSL::VERSION = *VERSION;
@inc::Module::Install::DSL::ISA = __PACKAGE__;
}
sub import {
# Read in the rest of the Makefile.PL
open 0 or die "Couldn't open $0: $!";
my $dsl;
SCOPE: {
local $/ = undef;
$dsl = join "", <0>;
}
# Change inc::Module::Install::DSL to the regular one.
# Remove anything before the use inc::... line.
$dsl =~ s/.*?^\s*use\s+(?:inc::)?Module::Install::DSL(\b[^;]*);\s*\n//sm;
# Load inc::Module::Install as we would in a regular Makefile.Pl
SCOPE: {
package main;
require inc::Module::Install;
inc::Module::Install->import;
}
# Add the ::DSL plugin to the list of packages in /inc
my $admin = $Module::Install::MAIN->{admin};
if ( $admin ) {
my $from = $INC{"$admin->{path}/DSL.pm"};
my $to = "$admin->{base}/$admin->{prefix}/$admin->{path}/DSL.pm";
$admin->copy( $from => $to );
}
# Convert the basic syntax to code
my $code = "{\n"
. "package main;\n\n"
. dsl2code($dsl)
. "\n\nWriteAll();\n"
. "}\n";
# Execute the script
eval $code;
print STDERR "Failed to execute the generated code...\n$@" if $@;
exit(0);
}
sub dsl2code {
my $dsl = shift;
# Split into lines and strip blanks
my @lines = grep { /\S/ } split /[\012\015]+/, $dsl;
# Each line represents one command
my @code = ();
my $static = 1;
foreach my $line ( @lines ) {
# Split the lines into tokens
my @tokens = split /\s+/, $line;
# The first word is the command
my $command = shift @tokens;
my @params = ();
my @suffix = ();
while ( @tokens ) {
my $token = shift @tokens;
if ( $token eq 'if' or $token eq 'unless' ) {
# This is the beginning of a suffix
push @suffix, $token;
push @suffix, @tokens;
# The conditional means this distribution
# can no longer be considered fully static.
$static = 0;
last;
} else {
# Convert to a string
$token =~ s/([\\\'])/\\$1/g;
push @params, "'$token'";
}
};
# Merge to create the final line of code
@tokens = ( $command, @params ? join( ', ', @params ) : (), @suffix );
push @code, join( ' ', @tokens ) . ";\n";
}
# Is our configuration static?
push @code, "static_config;\n" if $static;
# Join into the complete code block
return join( '', @code );
}
1;
|