xref: /openbsd-src/gnu/usr.bin/perl/lib/Config/Extensions.pm (revision a28daedfc357b214be5c701aa8ba8adb29a7f1c2)
1package Config::Extensions;
2use strict;
3use vars qw(%Extensions $VERSION @ISA @EXPORT_OK);
4use Config;
5require Exporter;
6
7$VERSION = '0.01';
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=head1 NAME
21
22Config::Extensions - hash lookup of which core extensions were built.
23
24=head1 SYNOPSIS
25
26    use Config::Extensions '%Extensions';
27    if ($Extensions{PerlIO::via}) {
28        # This perl has PerlIO::via built
29    }
30
31=head1 DESCRIPTION
32
33The Config::Extensions module provides a hash C<%Extensions> containing all
34the core extensions that were enabled for this perl. The hash is keyed by
35extension name, with each entry having one of 3 possible values:
36
37=over 4
38
39=item dynamic
40
41The extension is dynamically linked
42
43=item nonxs
44
45The extension is pure perl, so doesn't need linking to the perl executable
46
47=item static
48
49The extension is statically linked to the perl binary
50
51=back
52
53As all values evaluate to true, a simple C<if> test is good enough to determine
54whether an extension is present.
55
56All the data uses to generate the C<%Extensions> hash is already present in
57the C<Config> module, but not in such a convenient format to quickly reference.
58
59=head1 AUTHOR
60
61Nicholas Clark <nick@ccl4.org>
62
63=cut
64