annotate Lib/IMPL/Config/Path.pm @ 351:cfd7570c2af2

working on TTView: created TTView class for rendering models
author cin
date Tue, 08 Oct 2013 17:40:35 +0400
parents 91bae9f41a9c
children 212cc86e470b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
258
91bae9f41a9c Added class for referencing paths in configuration files
sergey
parents:
diff changeset
1 package IMPL::Config::Path;
91bae9f41a9c Added class for referencing paths in configuration files
sergey
parents:
diff changeset
2 use strict;
91bae9f41a9c Added class for referencing paths in configuration files
sergey
parents:
diff changeset
3 use IMPL::Config();
91bae9f41a9c Added class for referencing paths in configuration files
sergey
parents:
diff changeset
4
91bae9f41a9c Added class for referencing paths in configuration files
sergey
parents:
diff changeset
5 use IMPL::require {
91bae9f41a9c Added class for referencing paths in configuration files
sergey
parents:
diff changeset
6 Exception => 'IMPL::Exception',
91bae9f41a9c Added class for referencing paths in configuration files
sergey
parents:
diff changeset
7 OpException => '-IMPL::InvalidOperationException'
91bae9f41a9c Added class for referencing paths in configuration files
sergey
parents:
diff changeset
8 };
91bae9f41a9c Added class for referencing paths in configuration files
sergey
parents:
diff changeset
9
91bae9f41a9c Added class for referencing paths in configuration files
sergey
parents:
diff changeset
10 sub restore {
91bae9f41a9c Added class for referencing paths in configuration files
sergey
parents:
diff changeset
11 my ($self,$data,$surrogate) = @_;
91bae9f41a9c Added class for referencing paths in configuration files
sergey
parents:
diff changeset
12
91bae9f41a9c Added class for referencing paths in configuration files
sergey
parents:
diff changeset
13 die OpException->new("Invalid content") unless ref $data eq 'ARRAY' && @$data == 2;
91bae9f41a9c Added class for referencing paths in configuration files
sergey
parents:
diff changeset
14
91bae9f41a9c Added class for referencing paths in configuration files
sergey
parents:
diff changeset
15 my ($base,$path) = @$data;
91bae9f41a9c Added class for referencing paths in configuration files
sergey
parents:
diff changeset
16
91bae9f41a9c Added class for referencing paths in configuration files
sergey
parents:
diff changeset
17 my %types = (
91bae9f41a9c Added class for referencing paths in configuration files
sergey
parents:
diff changeset
18 appBase => 'AppBase',
91bae9f41a9c Added class for referencing paths in configuration files
sergey
parents:
diff changeset
19 configBase => 'ConfigBase'
91bae9f41a9c Added class for referencing paths in configuration files
sergey
parents:
diff changeset
20 );
91bae9f41a9c Added class for referencing paths in configuration files
sergey
parents:
diff changeset
21
91bae9f41a9c Added class for referencing paths in configuration files
sergey
parents:
diff changeset
22 my $method = $types{$base};
91bae9f41a9c Added class for referencing paths in configuration files
sergey
parents:
diff changeset
23
91bae9f41a9c Added class for referencing paths in configuration files
sergey
parents:
diff changeset
24 die OpException->new("Unsupported path type",$base) unless $method;
91bae9f41a9c Added class for referencing paths in configuration files
sergey
parents:
diff changeset
25
91bae9f41a9c Added class for referencing paths in configuration files
sergey
parents:
diff changeset
26 return IMPL::Config->$method($path);
91bae9f41a9c Added class for referencing paths in configuration files
sergey
parents:
diff changeset
27 }
91bae9f41a9c Added class for referencing paths in configuration files
sergey
parents:
diff changeset
28
91bae9f41a9c Added class for referencing paths in configuration files
sergey
parents:
diff changeset
29 1;