comparison Lib/IMPL/Config/Path.pm @ 258:91bae9f41a9c

Added class for referencing paths in configuration files
author sergey
date Tue, 18 Dec 2012 19:18:31 +0400
parents
children 212cc86e470b
comparison
equal deleted inserted replaced
256:32aceba4ee6d 258:91bae9f41a9c
1 package IMPL::Config::Path;
2 use strict;
3 use IMPL::Config();
4
5 use IMPL::require {
6 Exception => 'IMPL::Exception',
7 OpException => '-IMPL::InvalidOperationException'
8 };
9
10 sub restore {
11 my ($self,$data,$surrogate) = @_;
12
13 die OpException->new("Invalid content") unless ref $data eq 'ARRAY' && @$data == 2;
14
15 my ($base,$path) = @$data;
16
17 my %types = (
18 appBase => 'AppBase',
19 configBase => 'ConfigBase'
20 );
21
22 my $method = $types{$base};
23
24 die OpException->new("Unsupported path type",$base) unless $method;
25
26 return IMPL::Config->$method($path);
27 }
28
29 1;