lib/javonet-ruby-sdk/Binaries/Perl/MacOs/X64/deps/lib/perl5/ExtUtils/Config.pm in javonet-ruby-sdk-2.3.0 vs lib/javonet-ruby-sdk/Binaries/Perl/MacOs/X64/deps/lib/perl5/ExtUtils/Config.pm in javonet-ruby-sdk-2.4.2

- old
+ new

@@ -1,11 +1,10 @@ package ExtUtils::Config; -$ExtUtils::Config::VERSION = '0.008'; +$ExtUtils::Config::VERSION = '0.009'; use strict; use warnings; use Config; -use Data::Dumper (); sub new { my ($pack, $args) = @_; return bless { values => ($args ? { %$args } : {}), @@ -32,13 +31,28 @@ return { %Config, %{ $self->{values}} }; } sub serialize { my $self = shift; - return $self->{serialized} ||= Data::Dumper->new([$self->values_set])->Terse(1)->Sortkeys(1)->Dump; + require Data::Dumper; + return $self->{serialized} ||= Data::Dumper->new($self->{values})->Terse(1)->Sortkeys(1)->Dump; } +sub but { + my ($self, $args) = @_; + my %new = %{ $self->{values} }; + for my $key (keys %$args) { + if (defined $args->{$key}) { + $new{$key} = $args->{$key} + } + else { + delete $new{$key}; + } + } + return bless { values => \%new }, ref $self; +} + 1; # ABSTRACT: A wrapper for perl's configuration __END__ @@ -51,11 +65,11 @@ ExtUtils::Config - A wrapper for perl's configuration =head1 VERSION -version 0.008 +version 0.009 =head1 SYNOPSIS my $config = ExtUtils::Config->new(); $config->get('installsitelib'); @@ -76,20 +90,44 @@ =head2 exists($key) Tests for the existence of $key. +=head2 but(\%keys) + +This creates a new C<ExtUtils::Config> 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 method serializes the object to some kind of string. This can be useful for various caching purposes. + +=head1 SEE ALSO + +=over 4 + +=item * L<Module::Build::Tiny> + +=item * L<ExtUtils::InstallPaths> + +=item * L<CPAN::Static::Install> + +=item * L<ExtUtils::HasCompiler> + +=item * L<ExtUtils::Builder> + +=item * L<CPAN::Requirements::Dynamic> + +=item * L<Devel::FindPerl> + +=back =head1 AUTHORS =over 4