Changeset 16218 for misc/runpugs/bin

Show
Ignore:
Timestamp:
05/07/07 16:26:38 (19 months ago)
Author:
andara
Message:

[runpugs]
- Session.pm: now with Moose
- Session startup handling now more robust
- Repl.pm: a very simple mini-REPL for testing

Location:
misc/runpugs/bin
Files:
3 added
3 modified

Legend:

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

    r15833 r16218  
    66use strict; 
    77 
    8 use threads;           # pull in threading routines 
     8#use threads;           # pull in threading routines 
    99 
    1010use lib '../lib/'; 
     
    1919our $nclients_serial=500; 
    2020 
     21#for my $i (0..$n_threads-1) { 
     22#       $threads[$i]=threads->create("client_session",$i); 
     23#} 
     24 
     25# program exits when first thread exits 
     26my $pid; 
    2127for my $i (0..$n_threads-1) { 
    22         $threads[$i]=threads->create("client_session",$i); 
    23 } 
    24  
    25 # program exits when first thread exits 
    26 $threads[0]->join();  
     28        if($pid=fork()) { 
     29                print "Spawned $i\n";  
     30        } elsif (defined $pid) { # Child 
     31                        print "Running $i\n"; 
     32                        &client_session($i); 
     33                        exit(0); 
     34                } else { 
     35                        die "Fork failed!"; 
     36                } 
     37} 
     38print "Parent: done creating clients."; 
     39sleep 3600; 
     40#$threads[0]->join();  
    2741 
    2842 
     
    108122print "$i:WARNING2: $cmd<>$reply\n";# if $v; 
    109123#if ($reply eq '0') { 
    110 system("./killall_perl"); 
     124#system("./killall_perl"); 
     125kill 9,getppid(); 
    111126exit() ; 
    112127#} 
     
    118133} elsif ($abort) { 
    119134&send_cmd(':A',$id,$ip,$app); 
    120 } #�therwise do nothing, server should time the session out 
     135} #�otherwise do nothing, server should time the session out 
    121136my $w_log= rand($w_max_log)+$w_min_log; 
    122137my $wait=int(2**$w_log); 
    123138print "\n$i:Waiting for $wait seconds...\n" if $v; 
    124139sleep $wait;  
    125 } #�nd of nclients_serial loop 
     140} #�end of nclients_serial loop 
    126141 
    127142} 
  • misc/runpugs/bin/termdispatcher.pl

    r14512 r16218  
    66# 
    77use lib '../lib/'; 
    8 use WebTerminal::Dispatcher; 
     8use Web::Terminal::Settings; 
     9use Web::Terminal::Dispatcher; 
     10#$Web::Terminal::Settings::port=2058; 
    911 
    1012 
    1113my $id=$ARGV[0]||-1; 
    12 my $cmd=$ARGV[1] || 'my $a='.$id.';say "Hello, $a";'; 
    13 #my $cmd='my $a='.$id.';say "Hello, $a";'; 
    14 my $prompt='pugs> '; 
     14my $cmd=$ARGV[1] || 'print "hello\n";say "there";print 4'; 
    1515print "Sending msg $id: $cmd\n"; 
    1616my $ip="127.0.0.1"; 
    17 my $dev=1; 
    18 my $reply = &WebTerminal::Dispatcher::send($id,$ip,$dev,$prompt.$cmd); 
     17(my $reply,my $prompt,my $histref) = 
     18&Web::Terminal::Dispatcher::send($id,$ip,1,1,$cmd); 
    1919print $reply; 
     20print "\nHistory\n"; 
     21for my $entry (@{$histref}) { 
     22print "\t$entry\n"; 
     23} 
    2024 
  • misc/runpugs/bin/termserv.pl

    r14233 r16218  
    11#!/usr/bin/perl 
     2use strict; 
     3use warnings; 
     4#BEGIN { 
     5#$ENV{PERLIO}= ":utf8"; 
     6#} 
     7#use utf8; 
     8 
    29use warnings; 
    310use strict; 
    4 use utf8; 
     11 
    512use lib '../lib/'; 
    6 use WebTerminal::Server; 
    7 my $host = 'localhost'; 
    8 my $port = 2057; 
     13use Web::Terminal::Server; 
     14use  Web::Terminal::Settings; 
     15$Web::Terminal::Settings::port=2059; 
    916$ENV{PUGS_SAFEMODE}=1; 
    10 &WebTerminal::Server::run($host,$port); 
     17my $v=1-$Web::Terminal::Settings::daemon; 
     18print "Starting server\n" if $v; 
     19&Web::Terminal::Server::run(); 
    1120