Changeset 23463 for lang/perl/Yacafi

Show
Ignore:
Timestamp:
11/13/08 01:49:46 (5 years ago)
Author:
yappo
Message:

_response も inline すればいいよね、でもあんま変わんないなぁ

Files:
1 modified

Legend:

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

    r23461 r23463  
    6767 
    6868sub _response { 
    69     my $response = shift; 
    70     $response ||= +{ headers => +{}, body => '' }; 
    71     $response->{body} ||= ''; 
    72     $response->{headers}->{'Content-Length'} ||= length($response->{body}); 
    73     $response->{headers}->{'Content-Type'} ||= 'text/html'; 
    74  
    75     # build headers 
    76     my $out; 
    77     while (my($name, $values) = each %{ $response->{headers} }) { 
    78         next unless defined $values; 
    79         for my $value (ref($values) eq 'ARRAY' ? @{ $values } : ( $values )) { 
    80             $out .= sprintf "%s: %s\r\n", $name, $value; 
    81         } 
    82     } 
    83      
    84     $out . "\r\n" . $response->{body}; 
    8569} 
    8670 
     
    10488        }; 
    10589    } 
    106     print STDOUT _response($response); 
     90 
     91    $response ||= +{ headers => +{}, body => '' }; 
     92    $response->{body} ||= ''; 
     93    $response->{headers}->{'Content-Length'} ||= length($response->{body}); 
     94    $response->{headers}->{'Content-Type'} ||= 'text/html'; 
     95 
     96    # build headers 
     97    while (my($name, $values) = each %{ $response->{headers} }) { 
     98        next unless defined $values; 
     99        for my $value (ref($values) eq 'ARRAY' ? @{ $values } : ( $values )) { 
     100            printf STDOUT "%s: %s\r\n", $name, $value; 
     101        } 
     102    } 
     103    print STDOUT "\r\n" . $response->{body}; 
    107104} 
    108105