Mercurial > pub > Impl
comparison Lib/IMPL/Web/View/TTControl.pm @ 356:97131d500f16
TTView: added identifiers support
author | cin |
---|---|
date | Thu, 17 Oct 2013 17:48:50 +0400 |
parents | feeb3bc4a818 |
children | 833e663796c4 |
comparison
equal
deleted
inserted
replaced
355:8dfb9df07d02 | 356:97131d500f16 |
---|---|
11 base => [ | 11 base => [ |
12 'IMPL::Object' => undef | 12 'IMPL::Object' => undef |
13 ], | 13 ], |
14 props => [ | 14 props => [ |
15 context => PROP_RO, | 15 context => PROP_RO, |
16 template => PROP_RO, | 16 template => PROP_RO |
17 id => { | |
18 get => sub { shift->_stash->get('id') }, | |
19 set => sub { shift->_stash->set('id',shift) } | |
20 } | |
21 ] | 17 ] |
22 }; | 18 }; |
23 | |
24 | |
25 { | |
26 my $nextId = 1; | |
27 sub _GetNextId { | |
28 return '_' . $nextId++; | |
29 } | |
30 } | |
31 | 19 |
32 our $AUTOLOAD_REGEX = qr/^[a-z]/; | 20 our $AUTOLOAD_REGEX = qr/^[a-z]/; |
33 | 21 |
34 sub CTOR { | 22 sub CTOR { |
35 my ($this,$context,$template) = @_; | 23 my ($this,$context,$template) = @_; |
36 | 24 |
37 $this->context($context) | 25 $this->context($context) |
38 or die ArgException->new(context => 'A context is required'); | 26 or die ArgException->new(context => 'A context is required'); |
39 $this->template($template) | 27 $this->template($template) |
40 or die ArgException->new(template => 'A template is required'); | 28 or die ArgException->new(template => 'A template is required'); |
29 } | |
30 | |
31 sub _PopulateMethods { | |
32 my ($this,@methods) = @_; | |
33 | |
34 $this->_stash->update({ | |
35 map { | |
36 my $name = $_; | |
37 $name, | |
38 sub { | |
39 $this->$name(@_); | |
40 } | |
41 } @methods | |
42 }); | |
41 } | 43 } |
42 | 44 |
43 sub _stash { | 45 sub _stash { |
44 $_[0]->context->stash; | 46 $_[0]->context->stash; |
45 } | 47 } |