annotate lib/IMPL/Test/Plan.pm @ 407:c6e90e02dd17 ref20150831

renamed Lib->lib
author cin
date Fri, 04 Sep 2015 19:40:23 +0300
parents
children 9335cf010b23
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
407
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
1 package IMPL::Test::Plan;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
2 use strict;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
3 use warnings;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
4
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
5 use parent qw(IMPL::Object);
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
6 use IMPL::Class::Property;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
7
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
8 use IMPL::Exception;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
9 use IMPL::Test::Result;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
10 use IMPL::Test::BadUnit;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
11 use Error qw(:try);
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
12
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
13 use IMPL::Serialization;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
14 use IMPL::Serialization::XmlFormatter;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
15
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
16 BEGIN {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
17 public property Units => prop_all | prop_list;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
18 public property Results => prop_all | prop_list;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
19 public property Listeners => prop_all | prop_list;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
20 private property _Cache => prop_all | prop_list;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
21 private property _Count => prop_all;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
22 }
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
23
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
24 sub CTOR {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
25 my $this = shift;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
26 $this->Units(\@_);
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
27 }
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
28
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
29 sub restore {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
30 my ($class,$data,$instance) = @_;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
31
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
32 $instance ||= $class->surrogate;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
33
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
34 $instance->callCTOR();
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
35
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
36 my %args = @$data;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
37
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
38 $instance->Units($args{Units});
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
39 $instance->Results($args{Results}) if $args{Results};
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
40 $instance->Listeners($args{Listeners}) if $args{Listeners};
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
41 }
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
42
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
43 sub save {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
44 my ($this,$ctx) = @_;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
45
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
46 $ctx->AddVar(Units => [$this->Units]);
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
47 $ctx->AddVar(Results => [$this->Results]) if $this->Results;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
48 $ctx->AddVar(Listeners => [$this->Listeners]) if $this->Listeners;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
49 }
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
50
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
51 sub AddListener {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
52 my ($this,$listener) = @_;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
53
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
54 $this->Listeners($this->Listeners,$listener);
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
55 }
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
56
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
57 sub Prepare {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
58 my ($this) = @_;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
59
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
60 my $count = 0;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
61 my @cache;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
62
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
63 foreach my $Unit ($this->Units){
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
64 my %info;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
65
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
66 # preload module
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
67 undef $@;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
68
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
69 eval "require $Unit" unless (ref $Unit);
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
70
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
71 # handle loading errors
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
72 $Unit = new IMPL::Test::BadUnit($Unit,"Failed to load unit",$@) if $@;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
73
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
74 $info{Unit} = $Unit;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
75 try {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
76 $info{Tests} = [$Unit->List];
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
77 } otherwise {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
78 my $err = $@;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
79 $Unit = $info{Unit} = new IMPL::Test::BadUnit(
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
80 $Unit->can('UnitName') ?
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
81 $Unit->UnitName :
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
82 $Unit,
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
83 "Failed to extract tests",
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
84 $err
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
85 );
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
86 $info{Tests} = [$Unit->List];
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
87 };
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
88 $count += @{$info{Tests}};
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
89 push @cache, \%info if @{$info{Tests}};
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
90 }
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
91
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
92 $this->_Count($count);
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
93 $this->_Cache(\@cache);
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
94 }
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
95
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
96 sub Count {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
97 my ($this) = @_;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
98 return $this->_Count;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
99 }
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
100
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
101 sub Run {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
102 my $this = shift;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
103
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
104 die new IMPL::InvalidOperationException("You must call the prepare method before running the plan") unless $this->_Cache;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
105
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
106 $this->_Tell(RunPlan => $this);
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
107
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
108 my @resultsTotal;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
109
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
110 foreach my $info ($this->_Cache) {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
111 $this->_Tell(RunUnit => $info->{Unit});
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
112
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
113 my $data;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
114 undef $@;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
115 eval {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
116 $data = $info->{Unit}->StartUnit;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
117 };
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
118
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
119 my @results;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
120
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
121 if (not $@) {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
122
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
123 foreach my $test (@{$info->{Tests}}) {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
124 my $name = $test->Name;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
125
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
126 #protected creation of the test
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
127 $test = eval { $info->{Unit}->new($test); } || new IMPL::Test::BadUnit(
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
128 $info->{Unit}->can('UnitName') ?
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
129 $info->{Unit}->UnitName :
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
130 $info->{Unit},
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
131 "Failed to construct the test $name",
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
132 $@
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
133 );
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
134
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
135 # invoke the test
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
136 $this->_Tell(RunTest => $test);
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
137 my $result = $test->Run($data);
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
138 $this->_Tell(EndTest => $test,$result);
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
139
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
140 push @results,$result;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
141 }
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
142 } else {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
143 my $e = $@;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
144 my $badTest = new IMPL::Test::BadUnit(
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
145 $info->{Unit}->can('UnitName') ?
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
146 $info->{Unit}->UnitName :
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
147 $info->{Unit},
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
148 "Failed to initialize the unit",
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
149 $@
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
150 );
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
151 foreach my $test (@{$info->{Tests}}) {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
152
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
153 $this->_Tell(RunTest => $badTest);
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
154 my $result = new IMPL::Test::Result(
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
155 Name => $test->Name,
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
156 State => IMPL::Test::Result::FAIL,
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
157 Exception => $e
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
158 );
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
159 $this->_Tell(EndTest => $badTest,$result);
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
160 push @results,$result;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
161 }
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
162 }
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
163
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
164 eval {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
165 $info->{Unit}->FinishUnit($data);
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
166 };
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
167
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
168 undef $@;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
169
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
170 push @resultsTotal, { Unit => $info->{Unit}, Results => \@results};
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
171
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
172 $this->_Tell(EndUnit => $info->{Unit},\@results);
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
173 }
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
174
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
175 $this->Results(\@resultsTotal);
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
176 $this->_Tell(EndPlan => $this);
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
177 }
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
178
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
179 sub _Tell {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
180 my ($this,$what,@args) = @_;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
181
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
182 $_->$what(@args) foreach $this->Listeners;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
183 }
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
184
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
185 sub SaveXML {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
186 my ($this,$out) = @_;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
187
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
188 my $h;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
189
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
190 if (ref $out eq 'GLOB') {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
191 $h = $out;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
192 } elsif ($out and not ref $out) {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
193 open $h, ">", $out or die new IMPL::Exception("Failed to open file",$out);
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
194 } else {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
195 die new IMPL::InvalidOperationException("Invalid output specified");
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
196 }
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
197
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
198 my $s = new IMPL::Serializer(Formatter => new IMPL::Serialization::XmlFormatter( IdentOutput => 1, SkipWhitespace => 1) );
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
199 $s->Serialize($h,$this);
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
200 }
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
201
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
202 sub LoadXML {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
203 my ($self,$in) = @_;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
204
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
205 my $h;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
206
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
207 if (ref $in eq 'GLOB') {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
208 $h = $in;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
209 } elsif ($in and not ref $in) {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
210 open $h, ">", $in or die new IMPL::Exception("Failed to open file",$in);
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
211 } else {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
212 die new IMPL::InvalidOperationException("Invalid input specified");
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
213 }
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
214
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
215 my $s = new IMPL::Serializer(Formatter => new IMPL::Serialization::XmlFormatter( IdentOutput => 1, SkipWhitespace => 1) );
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
216 return $s->Deserialize($h);
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
217 }
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
218
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
219 sub xml {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
220 my $this = shift;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
221 my $str = '';
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
222
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
223 open my $h,'>',\$str or die new IMPL::Exception("Failed to create stream");
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
224 $this->SaveXML($h);
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
225 undef $h;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
226 return $str;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
227 }
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
228
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
229 sub LoadXMLString {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
230 my $self = shift;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
231 my $str = shift;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
232
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
233 open my $h,'<',\$str or die new IMPL::Exception("Failed to create stream");
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
234 return $self->LoadXML($h);
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
235 }
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
236
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
237
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
238 1;