<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">package ExtUtils::Config;
$ExtUtils::Config::VERSION = '0.010';
use strict;
use warnings;
use Config;

sub new {
	my ($pack, $args) = @_;
	return bless {
		values =&gt; ($args ? { %$args } : {}),
	}, $pack;
}

sub get {
	my ($self, $key) = @_;
	return exists $self-&gt;{values}{$key} ? $self-&gt;{values}{$key} : $Config{$key};
}

sub exists {
	my ($self, $key) = @_;
	return exists $self-&gt;{values}{$key} || exists $Config{$key};
}

sub values_set {
	my $self = shift;
	return { %{$self-&gt;{values}} };
}

sub all_config {
	my $self = shift;
	return { %Config, %{ $self-&gt;{values}} };
}

sub serialize {
	my $self = shift;
	require Data::Dumper;
	return $self-&gt;{serialized} ||= Data::Dumper-&gt;new([ $self-&gt;{values} ])-&gt;Terse(1)-&gt;Sortkeys(1)-&gt;Dump;
}

sub but {
	my ($self, $args) = @_;
	my %new = %{ $self-&gt;{values} };
	for my $key (keys %$args) {
		if (defined $args-&gt;{$key}) {
			$new{$key} = $args-&gt;{$key}
		}
		else {
			delete $new{$key};
		}
	}
	return bless { values =&gt; \%new }, ref $self;
}

1;

# ABSTRACT: A wrapper for perl's configuration

__END__

=pod

=encoding UTF-8

=head1 NAME

ExtUtils::Config - A wrapper for perl's configuration

=head1 VERSION

version 0.010

=head1 SYNOPSIS

 my $config = ExtUtils::Config-&gt;new();
 $config-&gt;get('installsitelib');

=head1 DESCRIPTION

ExtUtils::Config is an abstraction around the %Config hash. By itself it is not a particularly interesting module by any measure, however it ties together a family of modern toolchain modules.

=head1 METHODS

=head2 new(\%config)

Create a new ExtUtils::Config object. The values in C&lt;\%config&gt; are used to initialize the object.

=head2 get($key)

Get the value of C&lt;$key&gt;. If not overridden it will return the value in %Config.

=head2 exists($key)

Tests for the existence of $key.

=head2 but(\%keys)

This creates a new C&lt;ExtUtils::Config&gt; object based on the current one, but with the values in %keys replacing the current values. Any undefined value means it will be removed from the overriden set.

=head2 values_set()

Get a hashref of all overridden values.

=head2 all_config()

Get a hashref of the complete configuration, including overrides.

=head2 serialize()

This method serializes the object to some kind of string. This can be useful for various caching purposes.

=head1 SEE ALSO

=over 4

=item * L&lt;Module::Build::Tiny&gt;

=item * L&lt;ExtUtils::InstallPaths&gt;

=item * L&lt;CPAN::Static::Install&gt;

=item * L&lt;ExtUtils::HasCompiler&gt;

=item * L&lt;ExtUtils::Builder&gt;

=item * L&lt;CPAN::Requirements::Dynamic&gt;

=item * L&lt;Devel::FindPerl&gt;

=back

=head1 AUTHORS

=over 4

=item *

Ken Williams &lt;kwilliams@cpan.org&gt;

=item *

Leon Timmermans &lt;leont@cpan.org&gt;

=back

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2006 by Ken Williams, Leon Timmermans.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

=cut
</pre></body></html>