Changeset 15027 for misc/runpugs

Show
Ignore:
Timestamp:
01/10/07 17:10:03 (23 months ago)
Author:
andara
Message:

[runpugs]
-release of what was the 'devel' version, v0.3.0
-window/tab close now terminates session. Thanks diakopter.
-for those who didn't use the devel version: it's much faster now

Location:
misc/runpugs
Files:
2 removed
11 modified

Legend:

Unmodified
Added
Removed
  • misc/runpugs/README

    r14885 r15027  
    11============================================================================== 
    2 2006/12/12      Release of version 0.2.0 of runpugs/WebTerminal 
     22007/01/10      Release of version 0.3.0 of runpugs/Web::Terminal 
    33============================================================================== 
    44 
    55NAME 
    66    runpugs: a web teminal for interactive pugs  
    7     Web/Terminal: library for building a web terminal for interactive shells 
     7    Web::Terminal: library for building a web terminal for interactive shells 
    88 
    99INSTALLATION 
     
    1111    (e.g. ~/apache on feather, or /var/www elsewhere) 
    1212    Rename html folder if required (e.g. htdocs -> html or public_html) 
    13     * Start the terminal server script (bin/termserv2.pl)  
    14     * To run, simply point your browser to /cgi-bin/runpugs (stable CGI 
    15      version) or just /runpugs/ (unstable version with asynchronous 
    16      JavaScript interface, running under mod_perl) 
     13    * Start the terminal server script (bin/termserv3.pl)  
     14    * To run, simply point your browser to /runpugs/  
    1715 
    1816DESCRIPTION 
    1917    runpugs has two main components:  
    20     -a cgi script (cgi-bin/runpugs) which uses an html template 
    21     (data/runpugs.html). The latter calls the runpugs.css stylesheet from 
    22     htdocs/runpugs.css 
    23     -a server (bin/termserv2.pl) which handles the interactive pugs sessions and communicates with 
    24     the cgi script. The pugs sessions stay alive for some time (currently 10') if 
     18    -a mod_perl script (/perl/runpugs3) which uses an html template 
     19    (/data/runpugs_async3.html). The latter calls the runpugs.css stylesheet from 
     20    /htdocs/runpugs.css. The script is called from /htdocs/runpugs/index.html 
     21    -a server (/bin/termserv3.pl) which handles the interactive pugs sessions and communicates with 
     22    the mod_perl script. The pugs sessions stay alive for some time (currently 10') if 
    2523    left inactive. 
    2624 
    27     The unstable version has some AJAX-like goodness and runs under mod_perl. 
    28     The entrypoint is /htdocs/runpugs/index.html, which calls /perl/runpugs.pl 
     25    This version has some AJAX goodness and runs under mod_perl. 
     26    The entrypoint is /htdocs/runpugs/index.html, which calls /perl/runpugs3.pl 
    2927 
    3028   The underlying library, Web/Terminal, can in principle be used for any 
     
    4442============================================================================== 
    4543 
     44CHANGES IN VERSION 0.3.0 
     45    -Uses AJAX for persistent interface and mod_perl for speed 
     46    -Sessions are preloaded for fast startup 
     47    -The user interface behaves much more like a terminal. 
     48 
    4649CHANGES IN VERSION 0.2.0 
    4750    -Web/Terminal replaces the original WebTerminal modules. This 
  • misc/runpugs/TODO

    r14885 r15027  
    1 runpugs version 0.2.0 TODO: 
     1runpugs version 0.3.0 TODO: 
    22 
    3 2006/12/06 
     32007/01/10 
    44* Unicode: hack Net::Telnet so it handles Unicode 
    55* Improve POD 
    6 * Add proper copyright & licensing info, in particular to Msg.pm 
    76* Put more functionality in JS (clear, timeout, history) 
    8 * Use true AJAX for front-end (prototype.js) 
    9 * Convert to Perl: this is a nice long-term goal.  
     7* Use true AJAX for front-end (e.g. prototype.js) 
     8* Convert to Perl6: this is a nice long-term goal.  
    109    Perl 5 Modules to be ported: 
    1110    - IO::Pty (xs based) 
     
    1514    - The Perl 6 equivalents of POSIX, Errno, IO::Select, Carp 
    1615   Of course we can use the Perl 5 implementations for the time being. 
    17 * Test mod_perl; tailor code for mod_perl?    
  • misc/runpugs/cgi-perl/test.pl

    r14885 r15027  
    11print "Content-type: text/html\n\n"; 
    22print "Hi There!"; 
     3system('echo "1" > tmplog'); 
  • misc/runpugs/htdocs/index.html

    r14960 r15027  
    1616<p><tt>runpugs</tt> lives at <a 
    1717href="http://run.pugscode.org">run.pugscode.org</a>.</p> 
    18 <p>By default, the Pugs session will use the <a 
     18<p>By default, the pugs session will use the  latest development snapshot. You can choose the <a 
    1919href="http://search.cpan.org/search?query=perl6%3A%3Apugs">latest 
    20 release</a>. You can try the latest development snapshot of Pugs by selecting the 'Development' radio button.</p> 
     20release</a> by selecting 
     21the 'Release' radio button.</p> 
     22<!-- 
    2123<p>Don't hesitate to test the <em>development version</em> of 
    2224<tt>runpugs</tt>:</p><ul><li>try the <a 
    2325href="http://feather.perl6.nl:8080/runpugs/">interactive session</a> 
    2426with command history, fast startup and response and a persistent interface; </li>  
    25 <li>or <a 
     27<li>or--> 
     28<p>You can also <a 
    2629href="http://feather.perl6.nl:8080/cgi-bin/runp6script">run a full Perl 6 
    27 script</a> in <em>non-interactive</em> mode.</li> 
    28  
    29 </ul> 
    30  
     30script</a> in non-interactive mode. 
     31</p> 
     32<p>If your browser does not support JavaScript, you can use the <a 
     33href="http://feather.perl6.nl:8080/cgi-bin/runpugs">non-AJAX version</a>.</p> 
    3134<h2>Instructions</h2> 
    3235<p><tt>runpugs</tt> presents the pugs interactive shell. Only 
     
    4144<code>:q</code>)</dd><br> 
    4245</dl> 
    43 <p>Please be considerate and do <em>quit</em> your 
     46<!--<p>Please be considerate and do <em>quit</em> your 
    4447pugs session  before you close the browser window. 
    45 </p> 
     48</p>--> 
    4649<h2>Restrictions</h2> 
    4750<p>Because this is a web terminal, a number of restrictions apply:</p> 
     
    6972restrictive.</p> 
    7073<h2>Known issues</h2> 
    71 <p><tt>runpugs</tt> is a very young project, and there will certainly be some bugs. Some known issues are:</p> 
     74<p><tt>runpugs</tt> is a very young project, and there will certainly be some 
     75bugs. Known issues are:</p> 
    7276<ul> 
    7377<li>Unicode is not supported.</li> 
    74 <li>There is no command history.</li> 
    7578</ul> 
    7679<h2>Source</h2> 
  • misc/runpugs/htdocs/runpugs/index.html

    r14954 r15027  
    55<script language="JavaScript" src="runpugs.js"></script> 
    66</head> 
    7 <body> 
    8  
     7<body onunload="HandleOnUnload(event)"> 
    98<iframe src="/perl/runpugs3.pl" id="scratch" name="scratch" 
    109style="visibility:hidden" width="700px" height="1px"  onLoad="getreply()"></iframe> 
  • misc/runpugs/htdocs/runpugs/runpugs.js

    r14852 r15027  
    33var histentry=0; 
    44var reply=""; 
    5  
     5var sessionid=0; 
     6var reldev=1; 
    67function getnchars() { 
    78    return document.terminal.cmd.value.length 
     
    100101    histlist=scratchpad.terminal.history.options; 
    101102    histentry=histlist.length; 
     103    sessionid=scratchpad.terminal.sessionid.value; 
     104    //reldev=scratchpad.terminal.reldev.value; 
    102105    //histlist.reverse; 
    103106    document.terminal.cmd.value=reply; 
     
    141144</textarea> 
    142145*/ 
     146 
     147/* Courtesy of diakopter */ 
     148//WV01012007: But it does not send a ':q' on close.  
     149//in fact, it looks like the handler is completely ignored. 
     150function HandleOnUnload(evt) 
     151{ 
     152        if ( (navigator.userAgent.toUpperCase().indexOf( "SAFARI" ) == -1) &&  // Exclude Safari. 
     153        ( (document.all && window.screenLeft >= 10004)   // IE moves the window 10000 pixels to the right while closing it 
     154                || (!document.all && evt.target==null) ) )  // Firefox sets the target of the passed event to null. 
     155        { // The window has been closed.  Submit a logout request to the server. 
     156    var expireSessionUrl='/perl/runpugs3.pl?sessionid='+sessionid+'&reldev=1&ia=1&cmd=%3Aq'; 
     157                var objXMLCloser = null; 
     158                if ( !document.all && !XMLHttpRequest ) return; 
     159                if ( document.all ) { objXMLCloser = new ActiveXObject( "Microsoft.XMLHTTP" ) } 
     160                else if ( XMLHttpRequest ) { objXMLCloser = new XMLHttpRequest(); } 
     161                if (objXMLCloser) { objXMLCloser.open( 'GET', expireSessionUrl, false ); objXMLCloser.send( null ); } 
     162        } 
     163} 
     164 
     165/* usage:  
     166 
     167This will work in any server-language environment that maintains session state on the server with timeouts.  This will help prevent large accumulation of sessions in memory on the servers. 
     168 
     169You need to include the javascript file above. 
     170 
     171Usage: on the page where you want to trap the window close event, add the following to the body tag as follows:  
     172<body onunload="HandleOnUnload(event)"> 
     173 
     174*/ 
  • misc/runpugs/lib/Web/Terminal/Dispatcher3.pm

    r14891 r15027  
    22 
    33use vars qw( $VERSION ); 
    4 $VERSION = '0.2.0'; 
     4$VERSION = '0.3.0'; 
    55use strict; 
    66use utf8; 
  • misc/runpugs/lib/Web/Terminal/Server/Session.pm

    r14891 r15027  
    22 
    33use vars qw( $VERSION ); 
    4 $VERSION='0.2.0'; 
     4$VERSION='0.3.0'; 
    55use strict; 
    66use utf8; 
     
    155155       $obj->{pugs}->close(); 
    156156        kill 9, $obj->{'pid'}; 
    157         $lline.="Generated output is limited to $Web::Terminal::Settings::nlines lines. Aborted.\npugs"; 
     157        $lline.="Generated output is limited to $Web::Terminal::Settings::nlines lines. Aborted.\n"; 
    158158        $obj->{'error'}=1; 
    159159    } 
  • misc/runpugs/lib/Web/Terminal/Server3.pm

    r14954 r15027  
    251251                                return $Web::Terminal::Settings::prompt; 
    252252                        } 
    253                 } else { 
     253                #} else { 
     254            # WARNING: HERE WE MUST CHECK IF cmd eq ':q' 
     255            # IF SO, ignore!  
     256             } elsif ($cmd ne ':q') { 
    254257                        if ( $nsessions_per_ip{$ip} > 
    255258                                $Web::Terminal::Settings::nsessions_ip ) 
     
    289292                                        } 
    290293                                } 
    291                         } 
    292                 } 
     294                    } 
     295        } else { # a quit on a non-exisiting session  
     296             return "Session was already closed.\n"; 
     297            } 
    293298        } 
    294299    } else { # non-interactive 
  • misc/runpugs/lib/Web/Terminal/Settings.pm

    r14954 r15027  
    44 
    55use vars qw( $VERSION ); 
    6 $VERSION = '0.2.0'; 
     6$VERSION = '0.3.0'; 
    77use utf8; 
    88use strict; 
  • misc/runpugs/perl/runpugs3.pl

    r14954 r15027  
    6868                last; 
    6969        }; 
    70         $cmdline=~/$Web::Terminal::Settings::quit_message/  
     70        $cmdline=~/$Web::Terminal::Settings::quit_message|Aborted/  
    7171        && do { 
    7272        $cmd='clear'; 
     
    135135            $reply = "Sorry, Unicode is not yet supported.\n".$Web::Terminal::Settings::prompt; 
    136136        } else { 
    137             if ($cmd=~/>\s+(\:*help)\b/) { 
     137            if ($cmd=~/\s*(\:*help)\b/) { 
    138138                $cmd=~s/$1/:h/; 
    139             } elsif ($cmd=~/>\s+(\:*(quit|bye))\b/) { 
     139            } elsif ($cmd=~/\s*(\:*(quit|bye))\b/) { 
    140140                $cmd=~s/$1/:q/; 
    141141            }