summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlperl.straw/lib/Module/Build/Config.pm
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2010-02-28 09:36:33 +0000
committerNorbert Preining <preining@logic.at>2010-02-28 09:36:33 +0000
commit5589232e99f0fa13868111280c5b64ce9dc25730 (patch)
tree28f2e6ff422108ac87934aff9c3fc5911963625c /Master/tlpkg/tlperl.straw/lib/Module/Build/Config.pm
parenta6f5de6eed80d66fbd23ceabda7edf22b8162236 (diff)
add a tlperl.straw directory for public inspection
git-svn-id: svn://tug.org/texlive/trunk@17235 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/tlperl.straw/lib/Module/Build/Config.pm')
-rwxr-xr-xMaster/tlpkg/tlperl.straw/lib/Module/Build/Config.pm59
1 files changed, 59 insertions, 0 deletions
diff --git a/Master/tlpkg/tlperl.straw/lib/Module/Build/Config.pm b/Master/tlpkg/tlperl.straw/lib/Module/Build/Config.pm
new file mode 100755
index 00000000000..997960073fd
--- /dev/null
+++ b/Master/tlpkg/tlperl.straw/lib/Module/Build/Config.pm
@@ -0,0 +1,59 @@
+package Module::Build::Config;
+
+use strict;
+use vars qw($VERSION);
+$VERSION = '0.3603';
+$VERSION = eval $VERSION;
+use Config;
+
+sub new {
+ my ($pack, %args) = @_;
+ return bless {
+ stack => {},
+ values => $args{values} || {},
+ }, $pack;
+}
+
+sub get {
+ my ($self, $key) = @_;
+ return $self->{values}{$key} if ref($self) && exists $self->{values}{$key};
+ return $Config{$key};
+}
+
+sub set {
+ my ($self, $key, $val) = @_;
+ $self->{values}{$key} = $val;
+}
+
+sub push {
+ my ($self, $key, $val) = @_;
+ push @{$self->{stack}{$key}}, $self->{values}{$key}
+ if exists $self->{values}{$key};
+ $self->{values}{$key} = $val;
+}
+
+sub pop {
+ my ($self, $key) = @_;
+
+ my $val = delete $self->{values}{$key};
+ if ( exists $self->{stack}{$key} ) {
+ $self->{values}{$key} = pop @{$self->{stack}{$key}};
+ delete $self->{stack}{$key} unless @{$self->{stack}{$key}};
+ }
+
+ return $val;
+}
+
+sub values_set {
+ my $self = shift;
+ return undef unless ref($self);
+ return $self->{values};
+}
+
+sub all_config {
+ my $self = shift;
+ my $v = ref($self) ? $self->{values} : {};
+ return {%Config, %$v};
+}
+
+1;