Changeset 15027
- Timestamp:
- 01/10/07 17:10:03 (23 months ago)
- Location:
- misc/runpugs
- Files:
-
- 2 removed
- 11 modified
-
README (modified) (3 diffs)
-
TODO (modified) (2 diffs)
-
cgi-perl/test.pl (modified) (1 diff)
-
htdocs/index.html (modified) (3 diffs)
-
htdocs/runpugs/index.html (modified) (1 diff)
-
htdocs/runpugs/runpugs.js (modified) (3 diffs)
-
lib/Web/Terminal/Config.pm (deleted)
-
lib/Web/Terminal/Dispatcher3.pm (modified) (1 diff)
-
lib/Web/Terminal/Server/Session.pm (modified) (2 diffs)
-
lib/Web/Terminal/Server3.pm (modified) (2 diffs)
-
lib/Web/Terminal/Settings.pm (modified) (1 diff)
-
lib/WebTerminal (deleted)
-
perl/runpugs3.pl (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
misc/runpugs/README
r14885 r15027 1 1 ============================================================================== 2 200 6/12/12 Release of version 0.2.0 of runpugs/WebTerminal2 2007/01/10 Release of version 0.3.0 of runpugs/Web::Terminal 3 3 ============================================================================== 4 4 5 5 NAME 6 6 runpugs: a web teminal for interactive pugs 7 Web /Terminal: library for building a web terminal for interactive shells7 Web::Terminal: library for building a web terminal for interactive shells 8 8 9 9 INSTALLATION … … 11 11 (e.g. ~/apache on feather, or /var/www elsewhere) 12 12 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/ 17 15 18 16 DESCRIPTION 19 17 runpugs has two main components: 20 -a cgi script (cgi-bin/runpugs) which uses an html template21 ( data/runpugs.html). The latter calls the runpugs.css stylesheet from22 htdocs/runpugs.css23 -a server ( bin/termserv2.pl) which handles the interactive pugs sessions and communicates with24 the cgiscript. The pugs sessions stay alive for some time (currently 10') if18 -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 25 23 left inactive. 26 24 27 Th e unstable version has some AJAX-likegoodness and runs under mod_perl.28 The entrypoint is /htdocs/runpugs/index.html, which calls /perl/runpugs .pl25 This version has some AJAX goodness and runs under mod_perl. 26 The entrypoint is /htdocs/runpugs/index.html, which calls /perl/runpugs3.pl 29 27 30 28 The underlying library, Web/Terminal, can in principle be used for any … … 44 42 ============================================================================== 45 43 44 CHANGES 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 46 49 CHANGES IN VERSION 0.2.0 47 50 -Web/Terminal replaces the original WebTerminal modules. This -
misc/runpugs/TODO
r14885 r15027 1 runpugs version 0. 2.0 TODO:1 runpugs version 0.3.0 TODO: 2 2 3 200 6/12/063 2007/01/10 4 4 * Unicode: hack Net::Telnet so it handles Unicode 5 5 * Improve POD 6 * Add proper copyright & licensing info, in particular to Msg.pm7 6 * 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. 10 9 Perl 5 Modules to be ported: 11 10 - IO::Pty (xs based) … … 15 14 - The Perl 6 equivalents of POSIX, Errno, IO::Select, Carp 16 15 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 1 1 print "Content-type: text/html\n\n"; 2 2 print "Hi There!"; 3 system('echo "1" > tmplog'); -
misc/runpugs/htdocs/index.html
r14960 r15027 16 16 <p><tt>runpugs</tt> lives at <a 17 17 href="http://run.pugscode.org">run.pugscode.org</a>.</p> 18 <p>By default, the Pugs session will use the <a18 <p>By default, the pugs session will use the latest development snapshot. You can choose the <a 19 19 href="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> 20 release</a> by selecting 21 the 'Release' radio button.</p> 22 <!-- 21 23 <p>Don't hesitate to test the <em>development version</em> of 22 24 <tt>runpugs</tt>:</p><ul><li>try the <a 23 25 href="http://feather.perl6.nl:8080/runpugs/">interactive session</a> 24 26 with command history, fast startup and response and a persistent interface; </li> 25 <li>or <a 27 <li>or--> 28 <p>You can also <a 26 29 href="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 30 script</a> in non-interactive mode. 31 </p> 32 <p>If your browser does not support JavaScript, you can use the <a 33 href="http://feather.perl6.nl:8080/cgi-bin/runpugs">non-AJAX version</a>.</p> 31 34 <h2>Instructions</h2> 32 35 <p><tt>runpugs</tt> presents the pugs interactive shell. Only … … 41 44 <code>:q</code>)</dd><br> 42 45 </dl> 43 < p>Please be considerate and do <em>quit</em> your46 <!--<p>Please be considerate and do <em>quit</em> your 44 47 pugs session before you close the browser window. 45 </p> 48 </p>--> 46 49 <h2>Restrictions</h2> 47 50 <p>Because this is a web terminal, a number of restrictions apply:</p> … … 69 72 restrictive.</p> 70 73 <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 75 bugs. Known issues are:</p> 72 76 <ul> 73 77 <li>Unicode is not supported.</li> 74 <li>There is no command history.</li>75 78 </ul> 76 79 <h2>Source</h2> -
misc/runpugs/htdocs/runpugs/index.html
r14954 r15027 5 5 <script language="JavaScript" src="runpugs.js"></script> 6 6 </head> 7 <body> 8 7 <body onunload="HandleOnUnload(event)"> 9 8 <iframe src="/perl/runpugs3.pl" id="scratch" name="scratch" 10 9 style="visibility:hidden" width="700px" height="1px" onLoad="getreply()"></iframe> -
misc/runpugs/htdocs/runpugs/runpugs.js
r14852 r15027 3 3 var histentry=0; 4 4 var reply=""; 5 5 var sessionid=0; 6 var reldev=1; 6 7 function getnchars() { 7 8 return document.terminal.cmd.value.length … … 100 101 histlist=scratchpad.terminal.history.options; 101 102 histentry=histlist.length; 103 sessionid=scratchpad.terminal.sessionid.value; 104 //reldev=scratchpad.terminal.reldev.value; 102 105 //histlist.reverse; 103 106 document.terminal.cmd.value=reply; … … 141 144 </textarea> 142 145 */ 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. 150 function 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 167 This 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 169 You need to include the javascript file above. 170 171 Usage: 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 2 2 3 3 use vars qw( $VERSION ); 4 $VERSION = '0. 2.0';4 $VERSION = '0.3.0'; 5 5 use strict; 6 6 use utf8; -
misc/runpugs/lib/Web/Terminal/Server/Session.pm
r14891 r15027 2 2 3 3 use vars qw( $VERSION ); 4 $VERSION='0. 2.0';4 $VERSION='0.3.0'; 5 5 use strict; 6 6 use utf8; … … 155 155 $obj->{pugs}->close(); 156 156 kill 9, $obj->{'pid'}; 157 $lline.="Generated output is limited to $Web::Terminal::Settings::nlines lines. Aborted.\n pugs";157 $lline.="Generated output is limited to $Web::Terminal::Settings::nlines lines. Aborted.\n"; 158 158 $obj->{'error'}=1; 159 159 } -
misc/runpugs/lib/Web/Terminal/Server3.pm
r14954 r15027 251 251 return $Web::Terminal::Settings::prompt; 252 252 } 253 } else { 253 #} else { 254 # WARNING: HERE WE MUST CHECK IF cmd eq ':q' 255 # IF SO, ignore! 256 } elsif ($cmd ne ':q') { 254 257 if ( $nsessions_per_ip{$ip} > 255 258 $Web::Terminal::Settings::nsessions_ip ) … … 289 292 } 290 293 } 291 } 292 } 294 } 295 } else { # a quit on a non-exisiting session 296 return "Session was already closed.\n"; 297 } 293 298 } 294 299 } else { # non-interactive -
misc/runpugs/lib/Web/Terminal/Settings.pm
r14954 r15027 4 4 5 5 use vars qw( $VERSION ); 6 $VERSION = '0. 2.0';6 $VERSION = '0.3.0'; 7 7 use utf8; 8 8 use strict; -
misc/runpugs/perl/runpugs3.pl
r14954 r15027 68 68 last; 69 69 }; 70 $cmdline=~/$Web::Terminal::Settings::quit_message /70 $cmdline=~/$Web::Terminal::Settings::quit_message|Aborted/ 71 71 && do { 72 72 $cmd='clear'; … … 135 135 $reply = "Sorry, Unicode is not yet supported.\n".$Web::Terminal::Settings::prompt; 136 136 } else { 137 if ($cmd=~/ >\s+(\:*help)\b/) {137 if ($cmd=~/\s*(\:*help)\b/) { 138 138 $cmd=~s/$1/:h/; 139 } elsif ($cmd=~/ >\s+(\:*(quit|bye))\b/) {139 } elsif ($cmd=~/\s*(\:*(quit|bye))\b/) { 140 140 $cmd=~s/$1/:q/; 141 141 }
