annotate Lib/IMPL/DOM/Schema/Label.pm @ 395:212cc86e470b

Code cleanup DateTime locale support for HTTP requests
author sergey
date Thu, 20 Feb 2014 01:33:03 +0400
parents 5aff94ba842f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
381
ced5937ff21a Custom getters/setters support method names in theirs definitions
cin
parents:
diff changeset
1 package IMPL::DOM::Schema::Label;
ced5937ff21a Custom getters/setters support method names in theirs definitions
cin
parents:
diff changeset
2 use strict;
ced5937ff21a Custom getters/setters support method names in theirs definitions
cin
parents:
diff changeset
3 use overload
ced5937ff21a Custom getters/setters support method names in theirs definitions
cin
parents:
diff changeset
4 '""' => 'ToString',
ced5937ff21a Custom getters/setters support method names in theirs definitions
cin
parents:
diff changeset
5 'bool' => sub { return 1; },
ced5937ff21a Custom getters/setters support method names in theirs definitions
cin
parents:
diff changeset
6 'fallback' => 1;
ced5937ff21a Custom getters/setters support method names in theirs definitions
cin
parents:
diff changeset
7
ced5937ff21a Custom getters/setters support method names in theirs definitions
cin
parents:
diff changeset
8 use IMPL::Const qw(:prop);
ced5937ff21a Custom getters/setters support method names in theirs definitions
cin
parents:
diff changeset
9 use IMPL::Exception();
ced5937ff21a Custom getters/setters support method names in theirs definitions
cin
parents:
diff changeset
10 use IMPL::declare {
ced5937ff21a Custom getters/setters support method names in theirs definitions
cin
parents:
diff changeset
11 require => {
ced5937ff21a Custom getters/setters support method names in theirs definitions
cin
parents:
diff changeset
12 ArgException => '-IMPL::InvalidArgumentException'
ced5937ff21a Custom getters/setters support method names in theirs definitions
cin
parents:
diff changeset
13 },
ced5937ff21a Custom getters/setters support method names in theirs definitions
cin
parents:
diff changeset
14 base => [
ced5937ff21a Custom getters/setters support method names in theirs definitions
cin
parents:
diff changeset
15 'IMPL::Object' => undef
ced5937ff21a Custom getters/setters support method names in theirs definitions
cin
parents:
diff changeset
16 ],
ced5937ff21a Custom getters/setters support method names in theirs definitions
cin
parents:
diff changeset
17 props => [
ced5937ff21a Custom getters/setters support method names in theirs definitions
cin
parents:
diff changeset
18 _map => PROP_RW,
ced5937ff21a Custom getters/setters support method names in theirs definitions
cin
parents:
diff changeset
19 _id => PROP_RW
ced5937ff21a Custom getters/setters support method names in theirs definitions
cin
parents:
diff changeset
20 ]
ced5937ff21a Custom getters/setters support method names in theirs definitions
cin
parents:
diff changeset
21 };
ced5937ff21a Custom getters/setters support method names in theirs definitions
cin
parents:
diff changeset
22
ced5937ff21a Custom getters/setters support method names in theirs definitions
cin
parents:
diff changeset
23 sub CTOR {
ced5937ff21a Custom getters/setters support method names in theirs definitions
cin
parents:
diff changeset
24 my ($this,$map,$id) = @_;
ced5937ff21a Custom getters/setters support method names in theirs definitions
cin
parents:
diff changeset
25
ced5937ff21a Custom getters/setters support method names in theirs definitions
cin
parents:
diff changeset
26 die ArgException->new('map' => 'A strings map is required')
ced5937ff21a Custom getters/setters support method names in theirs definitions
cin
parents:
diff changeset
27 unless $map;
ced5937ff21a Custom getters/setters support method names in theirs definitions
cin
parents:
diff changeset
28 die ArgException->new('id' => 'A lable identifier is required')
ced5937ff21a Custom getters/setters support method names in theirs definitions
cin
parents:
diff changeset
29 unless $id;
383
2f16f13b000c DOM localization
cin
parents: 381
diff changeset
30
2f16f13b000c DOM localization
cin
parents: 381
diff changeset
31 $this->_map($map);
2f16f13b000c DOM localization
cin
parents: 381
diff changeset
32 $this->_id($id);
381
ced5937ff21a Custom getters/setters support method names in theirs definitions
cin
parents:
diff changeset
33 }
ced5937ff21a Custom getters/setters support method names in theirs definitions
cin
parents:
diff changeset
34
ced5937ff21a Custom getters/setters support method names in theirs definitions
cin
parents:
diff changeset
35 our $AUTOLOAD;
ced5937ff21a Custom getters/setters support method names in theirs definitions
cin
parents:
diff changeset
36 sub AUTOLOAD {
ced5937ff21a Custom getters/setters support method names in theirs definitions
cin
parents:
diff changeset
37 my ($this) = @_;
ced5937ff21a Custom getters/setters support method names in theirs definitions
cin
parents:
diff changeset
38
ced5937ff21a Custom getters/setters support method names in theirs definitions
cin
parents:
diff changeset
39 my ($method) = ($AUTOLOAD =~ /(\w+)$/);
ced5937ff21a Custom getters/setters support method names in theirs definitions
cin
parents:
diff changeset
40 return
ced5937ff21a Custom getters/setters support method names in theirs definitions
cin
parents:
diff changeset
41 if $method eq 'DESTROY';
ced5937ff21a Custom getters/setters support method names in theirs definitions
cin
parents:
diff changeset
42
383
2f16f13b000c DOM localization
cin
parents: 381
diff changeset
43 warn $this->_id . ".$method";
2f16f13b000c DOM localization
cin
parents: 381
diff changeset
44
2f16f13b000c DOM localization
cin
parents: 381
diff changeset
45 return $this->new($this->_map,$this->_id . ".$method");
381
ced5937ff21a Custom getters/setters support method names in theirs definitions
cin
parents:
diff changeset
46 }
ced5937ff21a Custom getters/setters support method names in theirs definitions
cin
parents:
diff changeset
47
ced5937ff21a Custom getters/setters support method names in theirs definitions
cin
parents:
diff changeset
48 sub ToString {
ced5937ff21a Custom getters/setters support method names in theirs definitions
cin
parents:
diff changeset
49 my ($this) = @_;
ced5937ff21a Custom getters/setters support method names in theirs definitions
cin
parents:
diff changeset
50 return $this->_map->GetString($this->_id);
ced5937ff21a Custom getters/setters support method names in theirs definitions
cin
parents:
diff changeset
51 }
ced5937ff21a Custom getters/setters support method names in theirs definitions
cin
parents:
diff changeset
52
389
5aff94ba842f DOM Schema refactoring complete
cin
parents: 383
diff changeset
53 sub Format {
5aff94ba842f DOM Schema refactoring complete
cin
parents: 383
diff changeset
54 my ($this,$args) = @_;
5aff94ba842f DOM Schema refactoring complete
cin
parents: 383
diff changeset
55
5aff94ba842f DOM Schema refactoring complete
cin
parents: 383
diff changeset
56 return $this->_map->GetString($this->_id,$args);
5aff94ba842f DOM Schema refactoring complete
cin
parents: 383
diff changeset
57 }
5aff94ba842f DOM Schema refactoring complete
cin
parents: 383
diff changeset
58
381
ced5937ff21a Custom getters/setters support method names in theirs definitions
cin
parents:
diff changeset
59 1;