annotate Lib/IMPL/DOM/Document.pm @ 100:df6b4f054957

Schema in progress Added simple mailer
author wizard
date Thu, 06 May 2010 00:54:17 +0400
parents 9d24db321029
children 196bf443b5e1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
1 package IMPL::DOM::Document;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
2 use strict;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
3 use warnings;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
4
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
5 use base qw(IMPL::DOM::Node);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
6
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
7 __PACKAGE__->PassThroughArgs;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
8
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
9 sub document {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
10 return $_[0];
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
11 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
12
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
13 sub Create {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
14 my ($this,$nodeName,$class,$refProps) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
15
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
16 $refProps ||= {};
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
17
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
18 delete $refProps->{nodeName};
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
19
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
20 return $class->new(
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
21 nodeName => $nodeName,
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
22 document => $this,
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
23 %$refProps
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
24 );
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
25 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
26
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
27 {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
28 my $empty;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
29 sub Empty() {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
30 return $empty ? $empty : $empty = __PACKAGE__->new(nodeName => 'Empty');
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
31 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
32 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
33
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
34 1;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
35 __END__
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
36
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
37 =pod
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
38
77
9d24db321029 Refactoring Web::TT
wizard
parents: 49
diff changeset
39 =head1 NAME
9d24db321029 Refactoring Web::TT
wizard
parents: 49
diff changeset
40
9d24db321029 Refactoring Web::TT
wizard
parents: 49
diff changeset
41 C<IMPL::DOM::Document> DOM документ.
9d24db321029 Refactoring Web::TT
wizard
parents: 49
diff changeset
42
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
43 =head1 DESCRIPTION
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
44
77
9d24db321029 Refactoring Web::TT
wizard
parents: 49
diff changeset
45 Документ, позволяет создавать узлы определенных типов, что позволяет абстрагироваться
9d24db321029 Refactoring Web::TT
wizard
parents: 49
diff changeset
46 от механизмов реального создания объектов. Т.о. например C<IMPL::DOM::Navigator::Builder>
9d24db321029 Refactoring Web::TT
wizard
parents: 49
diff changeset
47 может формировать произвольные документы.
9d24db321029 Refactoring Web::TT
wizard
parents: 49
diff changeset
48
9d24db321029 Refactoring Web::TT
wizard
parents: 49
diff changeset
49 =head1 SYNOPSIS
9d24db321029 Refactoring Web::TT
wizard
parents: 49
diff changeset
50
9d24db321029 Refactoring Web::TT
wizard
parents: 49
diff changeset
51 =begin code
9d24db321029 Refactoring Web::TT
wizard
parents: 49
diff changeset
52
9d24db321029 Refactoring Web::TT
wizard
parents: 49
diff changeset
53 package MyDocument;
9d24db321029 Refactoring Web::TT
wizard
parents: 49
diff changeset
54 use base qw(IMPL::DOM::Document);
9d24db321029 Refactoring Web::TT
wizard
parents: 49
diff changeset
55
9d24db321029 Refactoring Web::TT
wizard
parents: 49
diff changeset
56 sub Create {
9d24db321029 Refactoring Web::TT
wizard
parents: 49
diff changeset
57 my $this = shift;
9d24db321029 Refactoring Web::TT
wizard
parents: 49
diff changeset
58 my ($name,$class,$hashProps) = @_;
9d24db321029 Refactoring Web::TT
wizard
parents: 49
diff changeset
59
9d24db321029 Refactoring Web::TT
wizard
parents: 49
diff changeset
60 if ($class eq 'Info') {
9d24db321029 Refactoring Web::TT
wizard
parents: 49
diff changeset
61 return MyInfo->new($name,$hashProps->{date},$hashProps->{description});
9d24db321029 Refactoring Web::TT
wizard
parents: 49
diff changeset
62 } else {
9d24db321029 Refactoring Web::TT
wizard
parents: 49
diff changeset
63 # leave as it is
9d24db321029 Refactoring Web::TT
wizard
parents: 49
diff changeset
64 return $this->SUPER::Create(@_);
9d24db321029 Refactoring Web::TT
wizard
parents: 49
diff changeset
65 }
9d24db321029 Refactoring Web::TT
wizard
parents: 49
diff changeset
66 }
9d24db321029 Refactoring Web::TT
wizard
parents: 49
diff changeset
67
9d24db321029 Refactoring Web::TT
wizard
parents: 49
diff changeset
68 =end code
9d24db321029 Refactoring Web::TT
wizard
parents: 49
diff changeset
69
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
70 =head1 METHODS
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
71
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
72 =over
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
73
77
9d24db321029 Refactoring Web::TT
wizard
parents: 49
diff changeset
74 =item C< Create($nodeName,$class,$hashProps) >
9d24db321029 Refactoring Web::TT
wizard
parents: 49
diff changeset
75
9d24db321029 Refactoring Web::TT
wizard
parents: 49
diff changeset
76 Реализация по умолчанию. Создает узел определеннго типа с определенным именем и свойствами.
9d24db321029 Refactoring Web::TT
wizard
parents: 49
diff changeset
77
9d24db321029 Refactoring Web::TT
wizard
parents: 49
diff changeset
78 =begin code
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
79
77
9d24db321029 Refactoring Web::TT
wizard
parents: 49
diff changeset
80 sub Create {
9d24db321029 Refactoring Web::TT
wizard
parents: 49
diff changeset
81 my ($this,$nodeName,$class,$hashProps) = @_;
9d24db321029 Refactoring Web::TT
wizard
parents: 49
diff changeset
82
9d24db321029 Refactoring Web::TT
wizard
parents: 49
diff changeset
83 return $class->new (
9d24db321029 Refactoring Web::TT
wizard
parents: 49
diff changeset
84 nodeName => $nodeName,
9d24db321029 Refactoring Web::TT
wizard
parents: 49
diff changeset
85 document => $this,
9d24db321029 Refactoring Web::TT
wizard
parents: 49
diff changeset
86 %$hashProps
9d24db321029 Refactoring Web::TT
wizard
parents: 49
diff changeset
87 );
9d24db321029 Refactoring Web::TT
wizard
parents: 49
diff changeset
88 }
9d24db321029 Refactoring Web::TT
wizard
parents: 49
diff changeset
89
9d24db321029 Refactoring Web::TT
wizard
parents: 49
diff changeset
90 =end code
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
91
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
92 =back
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
93
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
94 =cut