comparison Lib/IMPL/Web/View/TTControl.pm @ 334:71221d79e6b4

removing web resources contracts
author cin
date Thu, 13 Jun 2013 02:24:57 +0400
parents 109f28643025
children 1090c1dd7429
comparison
equal deleted inserted replaced
333:cd6409f66a5f 334:71221d79e6b4
1 package IMPL::Web::View::TTControl; 1 package IMPL::Web::View::TTControl;
2 use strict; 2 use strict;
3 3
4 use IMPL::Const qw(:prop); 4 use IMPL::Const qw(:prop);
5 use IMPL::lang qw(:hash); 5 use IMPL::lang qw(:hash :base);
6 use Scalar::Util qw(blessed reftype); 6 use Scalar::Util qw(blessed reftype);
7 use IMPL::declare { 7 use IMPL::declare {
8 require => { 8 require => {
9 TemplateDocument => 'Template::Document', 9 TemplateDocument => 'Template::Document',
10 TTContext => 'Template::Context', 10 TTContext => 'Template::Context',
31 } 31 }
32 } 32 }
33 33
34 our $AUTOLOAD_REGEX = qr/^[a-z]/; 34 our $AUTOLOAD_REGEX = qr/^[a-z]/;
35 35
36 my %mapSkipAttributes = map { $_, 1 } qw(attributes context);
37
36 sub CTOR { 38 sub CTOR {
37 my ($this,$template,$context,$attrs) = @_; 39 my ($this,$template,$context,$attrs) = @_;
38 40
39 41
40 $this->template( $template ) or die new IMPL::ArgumentException("A template is required"); 42 $this->template( $template ) or die new IMPL::ArgumentException("A template is required");
41 $this->context( $context ) or die new IMPL::ArgumentException("A context is required"); 43
44 die IMPL::ArgumentException->new(context => "A context is required, supplied: $context")
45 unless is($context,TTContext);
46
47 $this->context( $context );
42 48
43 $this->attributes({}); 49 $this->attributes({});
44 50
45 if(ref($attrs) eq 'HASH') { 51 if(ref($attrs) eq 'HASH') {
46 while (my($key,$value) = each %$attrs) { 52 while (my($key,$value) = each %$attrs) {
53 next if $mapSkipAttributes{$key};
47 $this->SetAttribute($key,$value); 54 $this->SetAttribute($key,$value);
48 } 55 }
49 } 56 }
50 57
51 $this->id(_GetNextId()) unless $this->id; 58 $this->id(_GetNextId()) unless $this->id;