diff options
Diffstat (limited to 'libpiny')
-rw-r--r-- | libpiny/lib/Piny/Config.pm | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/libpiny/lib/Piny/Config.pm b/libpiny/lib/Piny/Config.pm index 9f43c19..d37fa67 100644 --- a/libpiny/lib/Piny/Config.pm +++ b/libpiny/lib/Piny/Config.pm @@ -162,6 +162,24 @@ sub save { $cs->write( $s->confpath ); }; +# Dump all tweakables + +my @tweakables = ( ); + +sub all_tweakables { + my ( $s ) = @_; + + my $r = { }; + + foreach my $t ( @tweakables ) { + eval { + $r->{$t} = $s->$t; + }; + }; + + return $r; +}; + # Tweakable helper sub tweakable { @@ -174,6 +192,8 @@ sub tweakable { if ( $attrname =~ /_/ ) { croak "Illegal attribute name $attrname! (use only one underbar)"; }; + push @tweakables, $attr; + has $attr => ( is => 'rw' , isa => $isa |