comparison Lib/IMPL/Web/Application/ResourceContract.pm @ 302:673581380e79

Added templates provider functionality to controls minor fixes
author cin
date Mon, 01 Apr 2013 00:41:48 +0400
parents 546957c50a36
children fe725fad2d90
comparison
equal deleted inserted replaced
301:aeeb57a12046 302:673581380e79
1 package IMPL::Web::Application::ResourceContract; 1 package IMPL::Web::Application::ResourceContract;
2 use strict; 2 use strict;
3
4 use IMPL::lang;
3 use IMPL::Const qw(:prop); 5 use IMPL::Const qw(:prop);
4 use IMPL::declare { 6 use IMPL::declare {
5 require => { 7 require => {
6 Exception => 'IMPL::Exception', 8 Exception => 'IMPL::Exception',
7 ArgumentException => '-IMPL::ArgumentException', 9 ArgumentException => '-IMPL::ArgumentException',
38 { map { lc($_), $verbs->{$_} } keys %$verbs } ); 40 { map { lc($_), $verbs->{$_} } keys %$verbs } );
39 41
40 my %nameMap; 42 my %nameMap;
41 43
42 foreach my $res (@$resources) { 44 foreach my $res (@$resources) {
45 if (ref $res->{contract} eq 'HASH') {
46 $res->{contract} = __PACKAGE__->new(%{$res->{contract}});
47 }
48
43 next unless $res->{contract}; 49 next unless $res->{contract};
50
44 if ( my $name = $res->{name} ) { 51 if ( my $name = $res->{name} ) {
45 $nameMap{$name} = $res; 52 $nameMap{$name} = $res;
46 } 53 }
47 if ( $res->{match} ) { 54 if ( $res->{match} ) {
48 $this->_regexpResources->Append($res); 55 $this->_regexpResources->Append($res);