diff options
author | rafl <rafl@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7> | 2008-08-18 15:00:48 +0000 |
---|---|---|
committer | rafl <rafl@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7> | 2008-08-18 15:00:48 +0000 |
commit | 0588557330ac9fceb8e13f8b740d05a49f55f2dc (patch) | |
tree | 9615d65c8a8ff1ea654160145099bb2ef000982b /lib/Reaction/UI/ViewPort/SiteLayout.pm | |
parent | 77ad2ed8d1bec1c1edb2f002d8fa6e7e745b6b57 (diff) | |
download | reaction-0588557330ac9fceb8e13f8b740d05a49f55f2dc.tar.gz reaction-0588557330ac9fceb8e13f8b740d05a49f55f2dc.zip |
coerce VP::SiteLayouts static_base_uri from URI.
Diffstat (limited to 'lib/Reaction/UI/ViewPort/SiteLayout.pm')
-rw-r--r-- | lib/Reaction/UI/ViewPort/SiteLayout.pm | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/Reaction/UI/ViewPort/SiteLayout.pm b/lib/Reaction/UI/ViewPort/SiteLayout.pm index 2c53f8b..15c637c 100644 --- a/lib/Reaction/UI/ViewPort/SiteLayout.pm +++ b/lib/Reaction/UI/ViewPort/SiteLayout.pm @@ -6,11 +6,22 @@ use aliased 'Reaction::UI::ViewPort'; use namespace::clean -except => [ qw(meta) ]; extends ViewPort; +{ + use Moose::Util::TypeConstraints qw/subtype where coerce from via/; + my $str_type = subtype 'Str' => where { 1 }; + my $uri_type = subtype 'Object' => where { $_->isa('URI') }; -has 'title' => (isa => 'Str', is => 'rw', lazy_fail => 1); + coerce $str_type + => from $uri_type + => via { "$_[0]" }; + + has 'static_base_uri' => (isa => $str_type, coerce => 1, is => 'rw', lazy_fail => 1); -has 'static_base_uri' => (isa => 'Str', is => 'rw', lazy_fail => 1); + no Moose::Util::TypeConstraints; +} + +has 'title' => (isa => 'Str', is => 'rw', lazy_fail => 1); has 'meta_info' => ( is => 'rw', isa => 'HashRef', |