changeset 292:6dc1c369eb71

sync
author cin
date Tue, 26 Feb 2013 02:21:03 +0400
parents 5d14baa35790
children 15d87ef41764
files Lib/IMPL/Resources/Strings.pm Lib/IMPL/Web/AutoLocator.pm
diffstat 2 files changed, 19 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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);
             }
         }
     }    
--- 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) = @_;