Changeset 24452

Show
Ignore:
Timestamp:
11/20/08 17:03:49 (7 weeks ago)
Author:
kazuho
Message:

defer loading of CGI::Simple in plugin::mobile

Location:
lang/perl/NanoA/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/NanoA/trunk/lib/NanoA.pm

    r24449 r24452  
    5858    return $self->{query} = shift 
    5959        if @_; 
     60    if ($self->{query} && ref $self->{query} eq 'CODE') { 
     61        $self->{query} = $self->{query}->($self); 
     62    } 
    6063    unless ($self->{query}) { 
    6164        require_once('CGI/Simple.pm'); 
  • lang/perl/NanoA/trunk/plugin/mobile.pm

    r24449 r24452  
    3131    # build query object by myself and register it, since in first prerun, 
    3232    # there is no query object yet 
    33     do { 
    34         NanoA::require_once('CGI/Simple.pm'); 
    35         local $CGI::Simple::PARAM_UTF8 = undef; 
    36         my $q = CGI::Simple->new(); 
    37         # error occurs when trying to replace contents using Vars 
    38         for my $n ($q->param) { 
    39             my @v = $q->param($n); 
    40             if (@v >= 2) { 
    41                 $_ = decode($charset, $_) 
    42                     for @v; 
    43                 $q->param($n, \@v); 
    44             } else { 
    45                 $q->param($n, decode($charset, $v[0])); 
     33    $app->query( 
     34        sub { 
     35            NanoA::require_once('CGI/Simple.pm'); 
     36            local $CGI::Simple::PARAM_UTF8 = undef; 
     37            my $q = CGI::Simple->new(); 
     38            # error occurs when trying to replace contents using Vars 
     39            for my $n ($q->param) { 
     40                my @v = $q->param($n); 
     41                if (@v >= 2) { 
     42                    $_ = decode($charset, $_) 
     43                        for @v; 
     44                    $q->param($n, \@v); 
     45                } else { 
     46                    $q->param($n, decode($charset, $v[0])); 
     47                } 
    4648            } 
    47         } 
    48         $app->query($q); 
    49     }; 
     49            $q; 
     50        }, 
     51    ); 
    5052} 
    5153