Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | # NOTE: Derived from blib/lib/Inline.pm. |
2 | # Changes made here will be lost when autosplit is run again. | |
3 | # See AutoSplit.pm. | |
4 | package Inline; | |
5 | ||
6 | #line 722 "blib/lib/Inline.pm (autosplit into blib/lib/auto/Inline/create_config_file.al)" | |
7 | #============================================================================== | |
8 | # Auto-detect installed Inline language support modules | |
9 | #============================================================================== | |
10 | sub create_config_file { | |
11 | my ($o, $dir) = @_; | |
12 | ||
13 | # This subroutine actually fires off another instance of perl. | |
14 | # with arguments that make this routine get called again. | |
15 | # That way the queried modules don't stay loaded. | |
16 | if (defined $o) { | |
17 | ($dir) = $dir =~ /(.*)/s if UNTAINT; | |
18 | my $perl = $Config{perlpath}; | |
19 | $perl = $^X unless -f $perl; | |
20 | ($perl) = $perl =~ /(.*)/s if UNTAINT; | |
21 | local $ENV{PERL5LIB} if defined $ENV{PERL5LIB}; | |
22 | local $ENV{PERL5OPT} if defined $ENV{PERL5OPT}; | |
23 | my $inline = $INC{'Inline.pm'}; | |
24 | $inline ||= File::Spec->curdir(); | |
25 | my($v,$d,$f) = File::Spec->splitpath($inline); | |
26 | $f = "" if $f eq 'Inline.pm'; | |
27 | $inline = File::Spec->catpath($v,$d,$f); | |
28 | my $INC = "-I$inline -I" . | |
29 | join(" -I", grep {(-d File::Spec->catdir($_,"Inline") or | |
30 | -d File::Spec->catdir($_,"auto","Inline") | |
31 | )} @INC); | |
32 | system "$perl $INC -MInline=_CONFIG_ -e1 $dir" | |
33 | and croak M20_config_creation_failed($dir); | |
34 | return; | |
35 | } | |
36 | ||
37 | my ($lib, $mod, $register, %checked, | |
38 | %languages, %types, %modules, %suffixes); | |
39 | LIB: | |
40 | for my $lib (@INC) { | |
41 | next unless -d File::Spec->catdir($lib,"Inline"); | |
42 | opendir LIB, File::Spec->catdir($lib,"Inline") | |
43 | or warn(M21_opendir_failed(File::Spec->catdir($lib,"Inline"))), next; | |
44 | while ($mod = readdir(LIB)) { | |
45 | next unless $mod =~ /\.pm$/; | |
46 | $mod =~ s/\.pm$//; | |
47 | next LIB if ($checked{$mod}++); | |
48 | if ($mod eq 'Config') { # Skip Inline::Config | |
49 | warn M14_usage_Config(); | |
50 | next; | |
51 | } | |
52 | next if $mod =~ /^(MakeMaker|denter|messages)$/; | |
53 | eval "require Inline::$mod;"; | |
54 | warn($@), next if $@; | |
55 | eval "\$register=&Inline::${mod}::register"; | |
56 | next if $@; | |
57 | my $language = ($register->{language}) | |
58 | or warn(M22_usage_register($mod)), next; | |
59 | for (@{$register->{aliases}}) { | |
60 | warn(M23_usage_alias_used($mod, $_, $languages{$_})), next | |
61 | if defined $languages{$_}; | |
62 | $languages{$_} = $language; | |
63 | } | |
64 | $languages{$language} = $language; | |
65 | $types{$language} = $register->{type}; | |
66 | $modules{$language} = "Inline::$mod"; | |
67 | $suffixes{$language} = $register->{suffix}; | |
68 | } | |
69 | closedir LIB; | |
70 | } | |
71 | ||
72 | my $file = File::Spec->catfile($ARGV[0],"config"); | |
73 | open CONFIG, "> $file" or croak M24_open_for_output_failed($file); | |
74 | print CONFIG Inline::denter->new() | |
75 | ->indent(*version => $Inline::VERSION, | |
76 | *languages => \%languages, | |
77 | *types => \%types, | |
78 | *modules => \%modules, | |
79 | *suffixes => \%suffixes, | |
80 | ); | |
81 | close CONFIG; | |
82 | exit 0; | |
83 | } | |
84 | ||
85 | # end of Inline::create_config_file | |
86 | 1; |