From 349f1bba495a8a390b6a5338ea3e222c80e1b7ac Mon Sep 17 00:00:00 2001 From: Julian Blake Kongslie Date: Tue, 12 Oct 2010 22:06:15 -0700 Subject: Add type constraints to tweakables. --- usr/src/libpiny/lib/Piny/Config.pm | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'usr') 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 -- cgit v1.2.3