Mercurial > pub > Impl
comparison Lib/IMPL/Web/AutoLocator.pm @ 244:a02b110da931
refactoring
fixed binding to CGI query parameters with multiple values
author | sergey |
---|---|
date | Mon, 22 Oct 2012 04:09:27 +0400 |
parents | 5c82eec23bb6 |
children | 32aceba4ee6d |
comparison
equal
deleted
inserted
replaced
243:cd2b1f121029 | 244:a02b110da931 |
---|---|
1 package IMPL::Web::AutoLocator; | 1 package IMPL::Web::AutoLocator; |
2 use strict; | 2 use strict; |
3 | 3 |
4 use overload '""' => 'toString'; | |
5 | |
4 use IMPL::Const qw(:prop); | 6 use IMPL::Const qw(:prop); |
5 use IMPL::lang qw( :hash ); | 7 use IMPL::lang qw(:hash); |
8 use IMPL::clone qw(clone); | |
6 use URI; | 9 use URI; |
7 use URI::Escape; | 10 use URI::Escape; |
8 use IMPL::declare { | 11 use IMPL::declare { |
9 require => { | 12 require => { |
10 Exception => 'IMPL::Exception', | 13 Exception => 'IMPL::Exception', |
20 view => PROP_RW, | 23 view => PROP_RW, |
21 query => PROP_RW, | 24 query => PROP_RW, |
22 hash => PROP_RW | 25 hash => PROP_RW |
23 ] | 26 ] |
24 }; | 27 }; |
28 | |
29 sub Clone { | |
30 my $this = shift; | |
31 | |
32 return clone($this); | |
33 } | |
25 | 34 |
26 sub Child { | 35 sub Child { |
27 my $this = shift; | 36 my $this = shift; |
28 my $child = shift or die ArgumentException->new("a child resource identifier is required"); | 37 my $child = shift or die ArgumentException->new("a child resource identifier is required"); |
29 die ArgumentException->new("a child resource can't be a reference") if ref $child; | 38 die ArgumentException->new("a child resource can't be a reference") if ref $child; |
60 my $url = URI->new($this->view ? $this->base . "." . $this->view : $this->base); | 69 my $url = URI->new($this->view ? $this->base . "." . $this->view : $this->base); |
61 $url->query_form($this->query); | 70 $url->query_form($this->query); |
62 $url->fragment($this->hash); | 71 $url->fragment($this->hash); |
63 | 72 |
64 return $url; | 73 return $url; |
74 } | |
75 | |
76 sub toString { | |
77 shift->url->as_string(); | |
65 } | 78 } |
66 | 79 |
67 sub AUTOLOAD { | 80 sub AUTOLOAD { |
68 our $AUTOLOAD; | 81 our $AUTOLOAD; |
69 | 82 |