Changeset 16617 for misc/runpugs

Show
Ignore:
Timestamp:
06/02/07 20:51:51 (18 months ago)
Author:
andara
Message:

[runpugs] -Better newline handling

Location:
misc/runpugs
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • misc/runpugs/bin/test_session.pl

    r16595 r16617  
    22use strict; 
    33use warnings; 
    4 use Perl6::Say; 
    5 use lib '../lib'; 
    64use Repl; 
    75use Web::Terminal::Server::Session; 
     
    1513my $subref = sub {my $cmd=shift;my $res=$session->write($cmd);chomp $res; return ($res,$session->{'prompt'});}; 
    1614 
    17 my $prompt =$session->prompt; 
    18 my $motd =$session->output; 
     15my $prompt =$session->{'prompt'}; 
     16my $motd =$session->{'output'}; 
    1917 
    2018my $repl = new Repl {subref=>$subref,prompt=>$prompt,motd=>$motd}; 
     
    3432                ); 
    3533                #$new_session->init(); 
    36                 if ( $new_session->error == 1 ) {                
     34                if ( $new_session->{'error'} == 1 ) {            
    3735                        # Something went wrong, failed to create a new session 
    3836                        print "Something went wrong, failed to create a new session:\n"; 
    39                         print $new_session->error; 
    40                         print $new_session->output;                      
     37                        print $new_session->{'error'}; 
     38                        print $new_session->{'output'};                  
    4139                } 
    4240 
  • misc/runpugs/lib/Repl.pm

    r16595 r16617  
    1414sub run { 
    1515        my $s=shift; 
     16    my $nl=shift || ""; 
    1617        print $s->motd,"\n",$s->prompt; 
    1718        while (<STDIN>) {                
     
    1920                chomp $_; 
    2021                (my $res,my $prompt)=$s->subref->($_); 
    21                 print $res,"\n",$prompt; 
     22                print $res,$nl,$prompt; 
    2223        } 
    2324} 
  • misc/runpugs/lib/Web/Terminal/Server/Session.pm

    r16595 r16617  
    1515$SIG{CHLD}='IGNORE'; 
    1616 
    17 my $v=1;#(1-$Web::Terminal::Settings::daemon)*(1-$Web::Terminal::Settings::test); 
     17my $v=0;#(1-$Web::Terminal::Settings::daemon)*(1-$Web::Terminal::Settings::test); 
    1818 
    1919    my $prompt ='/'.$Web::Terminal::Settings::prompt.'/'; 
     
    257257    chomp $ps; # a hack! 
    258258        $obj->{prompt}=$ps; 
     259   $lline.="\n" unless $lline=~/^\s*$/; 
    259260        return $lline; 
    260261} # END of write() method