Mercurial > pub > Impl
annotate Lib/IMPL/Config/Path.pm @ 395:212cc86e470b
Code cleanup
DateTime locale support for HTTP requests
author | sergey |
---|---|
date | Thu, 20 Feb 2014 01:33:03 +0400 |
parents | 91bae9f41a9c |
children |
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 = ( |
395 | 18 appBase => 'AppDir', |
19 configBase => 'ConfigDir' | |
258
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; |