Show
Ignore:
Timestamp:
07/21/08 21:42:48 (6 months ago)
Author:
hoge1e3
Message:
 
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/actionscript/todoshare/perl/Html.pm

    r16014 r16061  
    11package stream; 
     2use strict; 
    23 
    34sub new { 
     
    2324       } 
    2425       return; 
     26    } 
     27    #print (ref $tag); 
     28    if ((ref $tag) eq "CODE") { 
     29       my @args=@$c; 
     30       $args[0]=$t; 
     31       return &{$tag}(@args); 
    2532    } 
    2633    $t->out("<$tag ");  
     
    8087 
    8188package Html; 
     89use strict; 
    8290 
    8391our @EXPORT = qw(header p brln); 
     
    8593 
    8694sub header { 
    87   print "Content-type: text/html; charset=utf-8\n\n"; 
     95  my %args=(type=>"text/html" ,@_); 
     96  print "Content-type: $args{type}; charset=utf-8\n\n"; 
    8897} 
    8998sub brln { 
     
    91100} 
    92101 
    93 sub p { 
    94   my $c=shift; 
     102sub stdoutStream { 
    95103  new stream(sub { 
    96104      my $s=shift;  
    97105      print $s; 
    98   })->p($c); 
     106  }); 
     107} 
     108sub p { 
     109  my $c=shift; 
     110  &stdoutStream->p($c); 
    99111} 
    1001121;