1package Config::Extensions; 2use strict; 3our (%Extensions, $VERSION, @ISA, @EXPORT_OK); 4use Config; 5require Exporter; 6 7$VERSION = '0.03'; 8@ISA = 'Exporter'; 9@EXPORT_OK = '%Extensions'; 10 11foreach my $type (qw(static dynamic nonxs)) { 12 foreach (split /\s+/, $Config{$type . '_ext'}) { 13 s!/!::!g; 14 $Extensions{$_} = $type; 15 } 16} 17 181; 19__END__ 20 21=head1 NAME 22 23Config::Extensions - hash lookup of which core extensions were built. 24 25=head1 SYNOPSIS 26 27 use Config::Extensions '%Extensions'; 28 if ($Extensions{PerlIO::via}) { 29 # This perl has PerlIO::via built 30 } 31 32=head1 DESCRIPTION 33 34The Config::Extensions module provides a hash C<%Extensions> containing all 35the core extensions that were enabled for this perl. The hash is keyed by 36extension name, with each entry having one of 3 possible values: 37 38=over 4 39 40=item dynamic 41 42The extension is dynamically linked 43 44=item nonxs 45 46The extension is pure perl, so doesn't need linking to the perl executable 47 48=item static 49 50The extension is statically linked to the perl binary 51 52=back 53 54As all values evaluate to true, a simple C<if> test is good enough to determine 55whether an extension is present. 56 57All the data uses to generate the C<%Extensions> hash is already present in 58the C<Config> module, but not in such a convenient format to quickly reference. 59 60=head1 AUTHOR 61 62Nicholas Clark <nick@ccl4.org> 63 64=cut 65