diff options
author | Julian Blake Kongslie <jblake@omgwallhack.org> | 2010-10-12 22:06:15 -0700 |
---|---|---|
committer | Julian Blake Kongslie <jblake@omgwallhack.org> | 2010-10-12 22:06:15 -0700 |
commit | 349f1bba495a8a390b6a5338ea3e222c80e1b7ac (patch) | |
tree | 38fc193b965e67c1be6b2a7cf940142147be1c22 /usr | |
parent | 668d2eac0b9882eb932ffc939e12e6fdf43c410a (diff) | |
download | piny-code-349f1bba495a8a390b6a5338ea3e222c80e1b7ac.tar.gz piny-code-349f1bba495a8a390b6a5338ea3e222c80e1b7ac.zip |
Add type constraints to tweakables.
Diffstat (limited to 'usr')
-rw-r--r-- | usr/src/libpiny/lib/Piny/Config.pm | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/usr/src/libpiny/lib/Piny/Config.pm b/usr/src/libpiny/lib/Piny/Config.pm index 8894bad..00e4902 100644 --- a/usr/src/libpiny/lib/Piny/Config.pm +++ b/usr/src/libpiny/lib/Piny/Config.pm @@ -122,7 +122,7 @@ sub save { # Tweakable helper sub tweakable { - my ( $attr, $default ) = @_; + my ( $attr, $default, $isa ) = @_; my $attrname = $attr; $attrname =~ s/_/./; @@ -131,7 +131,7 @@ sub tweakable { has $attr => ( is => 'rw' - , isa => 'Str' + , isa => $isa , lazy_build => 1 , trigger => sub { my ( $s, $new, $old ) = @_; @@ -169,12 +169,12 @@ sub tweakable { # The tweakables -tweakable "piny_ikiwikidestdir" => "/srv/www/piny.be/"; -tweakable "piny_ikiwikisrcdir" => "/srv/ikiwiki/"; -tweakable "piny_ikiwikiurl" => "http://piny.be/"; -tweakable "piny_ikiwikisecureurl" => "https://secure.piny.be/"; -tweakable "piny_ikiwikisecurepath" => "/srv/www/secure.piny.be/"; -tweakable "receive_denyNonFastforwards" => "true"; +tweakable "piny_ikiwikidestdir" => "/srv/www/piny.be/", 'Str'; +tweakable "piny_ikiwikisrcdir" => "/srv/ikiwiki/", 'Str'; +tweakable "piny_ikiwikiurl" => "http://piny.be/", 'Str'; +tweakable "piny_ikiwikisecureurl" => "https://secure.piny.be/", 'Str'; +tweakable "piny_ikiwikisecurepath" => "/srv/www/secure.piny.be/", 'Str'; +tweakable "receive_denyNonFastforwards" => "true", 'Bool'; # Moose boilerplate |