comparison Lib/IMPL/Web/View/TTLoader.pm @ 336:86336d451b82

sync
author cin
date Fri, 14 Jun 2013 03:32:55 +0400
parents d3b5a67ad2e8
children 9bdccdf1f50b
comparison
equal deleted inserted replaced
335:e8be9062ecf2 336:86336d451b82
1 package IMPL::Web::View::TTLoader; 1 package IMPL::Web::View::TTLoader;
2 use strict; 2 use strict;
3 3
4 use Template::Constants qw(:status); 4 use Template::Constants qw(:status);
5 5
6 use File::Spec();
6 use IMPL::Const qw(:prop); 7 use IMPL::Const qw(:prop);
7 use IMPL::declare { 8 use IMPL::declare {
8 require => { 9 require => {
9 Provider => 'Template::Provider', 10 Provider => 'Template::Provider',
10 Context => 'Template::Context', 11 Context => 'Template::Context',
116 } 117 }
117 118
118 return $tt; 119 return $tt;
119 } 120 }
120 121
122 sub ResolveFileName {
123 my ($this,$fname) = @_;
124
125 $fname = $this->_appendExt($fname);
126
127 my @files = grep -f , map File::Spec->catfile($_,$fname), @{$this->provider->paths()};
128 return shift @files;
129 }
130
121 sub _appendExt { 131 sub _appendExt {
122 my ($this,$name) = @_; 132 my ($this,$name) = @_;
123 133
124 return $name unless $this->ext; 134 return $name unless $this->ext;
125 135