xref: /openbsd-src/gnu/usr.bin/perl/lib/Config/Extensions.pm (revision f3efcd0145415b7d44d9da97e0ad5c21b186ac61)
1850e2753Smillertpackage Config::Extensions;
2850e2753Smillertuse strict;
35759b3d2Safresh1our (%Extensions, $VERSION, @ISA, @EXPORT_OK);
4850e2753Smillertuse Config;
5850e2753Smillertrequire Exporter;
6850e2753Smillert
7*f3efcd01Safresh1$VERSION = '0.03';
8850e2753Smillert@ISA = 'Exporter';
9850e2753Smillert@EXPORT_OK = '%Extensions';
10850e2753Smillert
11850e2753Smillertforeach my $type (qw(static dynamic nonxs)) {
12850e2753Smillert    foreach (split /\s+/, $Config{$type . '_ext'}) {
13850e2753Smillert	s!/!::!g;
14850e2753Smillert	$Extensions{$_} = $type;
15850e2753Smillert    }
16850e2753Smillert}
17850e2753Smillert
18850e2753Smillert1;
19850e2753Smillert__END__
20*f3efcd01Safresh1
21850e2753Smillert=head1 NAME
22850e2753Smillert
23850e2753SmillertConfig::Extensions - hash lookup of which core extensions were built.
24850e2753Smillert
25850e2753Smillert=head1 SYNOPSIS
26850e2753Smillert
27850e2753Smillert    use Config::Extensions '%Extensions';
28850e2753Smillert    if ($Extensions{PerlIO::via}) {
29850e2753Smillert        # This perl has PerlIO::via built
30850e2753Smillert    }
31850e2753Smillert
32850e2753Smillert=head1 DESCRIPTION
33850e2753Smillert
34850e2753SmillertThe Config::Extensions module provides a hash C<%Extensions> containing all
35850e2753Smillertthe core extensions that were enabled for this perl. The hash is keyed by
36850e2753Smillertextension name, with each entry having one of 3 possible values:
37850e2753Smillert
38850e2753Smillert=over 4
39850e2753Smillert
40850e2753Smillert=item dynamic
41850e2753Smillert
42850e2753SmillertThe extension is dynamically linked
43850e2753Smillert
44850e2753Smillert=item nonxs
45850e2753Smillert
46850e2753SmillertThe extension is pure perl, so doesn't need linking to the perl executable
47850e2753Smillert
48850e2753Smillert=item static
49850e2753Smillert
50850e2753SmillertThe extension is statically linked to the perl binary
51850e2753Smillert
52850e2753Smillert=back
53850e2753Smillert
54850e2753SmillertAs all values evaluate to true, a simple C<if> test is good enough to determine
55850e2753Smillertwhether an extension is present.
56850e2753Smillert
57850e2753SmillertAll the data uses to generate the C<%Extensions> hash is already present in
58850e2753Smillertthe C<Config> module, but not in such a convenient format to quickly reference.
59850e2753Smillert
60850e2753Smillert=head1 AUTHOR
61850e2753Smillert
62850e2753SmillertNicholas Clark <nick@ccl4.org>
63850e2753Smillert
64850e2753Smillert=cut
65