# HG changeset patch # User cin # Date 1361830863 -14400 # Node ID 6dc1c369eb713f7838f946c59037d5bf48365d66 # Parent 5d14baa35790a4c203ffbea0a05d72a83fcc0f8e sync diff -r 5d14baa35790 -r 6dc1c369eb71 Lib/IMPL/Resources/Strings.pm --- a/Lib/IMPL/Resources/Strings.pm Thu Feb 21 03:44:02 2013 +0400 +++ b/Lib/IMPL/Resources/Strings.pm Tue Feb 26 02:21:03 2013 +0400 @@ -10,6 +10,7 @@ our $Locale ||= 'default'; our $Encoding ||= 'utf-8'; our @Locations; +my %maps; sub import { my ($self,$refStrings,%options) = @_; @@ -17,16 +18,18 @@ no strict 'refs'; my $class = caller; + my $methods = $options{methods}; if (ref $refStrings eq 'HASH') { - my %map; + my $map = ( $maps{$class} ||= {} ); while(my ($name,$format) = each %$refStrings) { - $map{default}{$name} = $format; + $map->{default}{$name} = $format; *{"${class}::$name"} = sub { + shift if $methods; my $args = @_ == 1 ? shift : { @_ }; - return _FormatMapMessage($class,$name,\%map,$Locale,$args); + return _FormatMapMessage($class,$name,$map,$Locale,$args); } } } diff -r 5d14baa35790 -r 6dc1c369eb71 Lib/IMPL/Web/AutoLocator.pm --- a/Lib/IMPL/Web/AutoLocator.pm Thu Feb 21 03:44:02 2013 +0400 +++ b/Lib/IMPL/Web/AutoLocator.pm Tue Feb 26 02:21:03 2013 +0400 @@ -55,6 +55,19 @@ return $this->new(%args); } +sub Query { + my ($this,$query) = @_; + + my %args; + + $args{base} = $this->base; + $args{view} = $this->view if $this->view; + $args{hash} = $this->hash if $this->hash; + $args{query} = ref $query eq 'HASH' ? hashMerge($this->query,$query) : $query; + + return $this->new(%args); +} + sub SetView { my ($this,$newView) = @_;