Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Move Philip Gwyn's signals test to POE::Test::Loops, so it can

exercise everyone's event loops.
  • Loading branch information...
commit 364246096c8de24e9ff51e83343407a8b2faa5d4 1 parent a88bc2c
Rocco Caputo authored August 08, 2009

Showing 123 changed files with 4 additions and 43,249 deletions. Show diff stats Hide diff stats

  1. 3  poe-test-loops/MANIFEST
  2. 2  poe/t/90_regression/leolo-poe-wheel-run.t → poe-test-loops/lib/POE/Test/Loops/z_leolo_wheel_run.pm
  3. 464  poe/HISTORY
  4. 153  poe/MANIFEST
  5. 30  poe/MANIFEST.SKIP
  6. 78  poe/Makefile.PL
  7. 94  poe/README
  8. 20  poe/TODO
  9. 17  poe/docs/Makefile
  10. 55  poe/docs/POE-HINTS.outline
  11. 1,856  poe/docs/POE-TODO.outline
  12. 357  poe/docs/out-out.perl
  13. 3  poe/examples/README.samples
  14. 229  poe/examples/create.perl
  15. 177  poe/examples/fakelogin.perl
  16. 186  poe/examples/forkbomb.perl
  17. 323  poe/examples/names.perl
  18. 143  poe/examples/objmaps.perl
  19. 137  poe/examples/objsessions.perl
  20. 125  poe/examples/packagesessions.perl
  21. 145  poe/examples/queue.perl
  22. 378  poe/examples/selects.perl
  23. 212  poe/examples/sessions.perl
  24. 121  poe/examples/signals.perl
  25. 162  poe/examples/tcp_watermarks.perl
  26. 470  poe/examples/thrash.perl
  27. 199  poe/examples/watermarks.perl
  28. 160  poe/examples/wheels2.perl
  29. 689  poe/lib/POE.pm
  30. 121  poe/lib/POE/Component.pm
  31. 806  poe/lib/POE/Component/Client/TCP.pm
  32. 1,375  poe/lib/POE/Component/Server/TCP.pm
  33. 169  poe/lib/POE/Driver.pm
  34. 255  poe/lib/POE/Driver/SysRW.pm
  35. 367  poe/lib/POE/Filter.pm
  36. 282  poe/lib/POE/Filter/Block.pm
  37. 237  poe/lib/POE/Filter/Grep.pm
  38. 539  poe/lib/POE/Filter/HTTPD.pm
  39. 380  poe/lib/POE/Filter/Line.pm
  40. 243  poe/lib/POE/Filter/Map.pm
  41. 225  poe/lib/POE/Filter/RecordBlock.pm
  42. 400  poe/lib/POE/Filter/Reference.pm
  43. 379  poe/lib/POE/Filter/Stackable.pm
  44. 131  poe/lib/POE/Filter/Stream.pm
  45. 5,374  poe/lib/POE/Kernel.pm
  46. 92  poe/lib/POE/Loader.pm
  47. 574  poe/lib/POE/Loop.pm
  48. 247  poe/lib/POE/Loop/Event.pm
  49. 356  poe/lib/POE/Loop/Gtk.pm
  50. 427  poe/lib/POE/Loop/IO_Poll.pm
  51. 204  poe/lib/POE/Loop/PerlSignals.pm
  52. 374  poe/lib/POE/Loop/Select.pm
  53. 241  poe/lib/POE/Loop/Tk.pm
  54. 291  poe/lib/POE/Loop/TkActiveState.pm
  55. 193  poe/lib/POE/Loop/TkCommon.pm
  56. 1,092  poe/lib/POE/NFA.pm
  57. 292  poe/lib/POE/Pipe.pm
  58. 205  poe/lib/POE/Pipe/OneWay.pm
  59. 220  poe/lib/POE/Pipe/TwoWay.pm
  60. 310  poe/lib/POE/Queue.pm
  61. 470  poe/lib/POE/Queue/Array.pm
  62. 84  poe/lib/POE/Resource.pm
  63. 174  poe/lib/POE/Resource/Aliases.pm
  64. 333  poe/lib/POE/Resource/Events.pm
  65. 214  poe/lib/POE/Resource/Extrefs.pm
  66. 876  poe/lib/POE/Resource/FileHandles.pm
  67. 125  poe/lib/POE/Resource/SIDs.pm
  68. 579  poe/lib/POE/Resource/Sessions.pm
  69. 917  poe/lib/POE/Resource/Signals.pm
  70. 334  poe/lib/POE/Resource/Statistics.pm
  71. 87  poe/lib/POE/Resources.pm
  72. 1,735  poe/lib/POE/Session.pm
  73. 334  poe/lib/POE/Wheel.pm
  74. 250  poe/lib/POE/Wheel/Curses.pm
  75. 821  poe/lib/POE/Wheel/FollowTail.pm
  76. 357  poe/lib/POE/Wheel/ListenAccept.pm
  77. 3,558  poe/lib/POE/Wheel/ReadLine.pm
  78. 1,180  poe/lib/POE/Wheel/ReadWrite.pm
  79. 1,792  poe/lib/POE/Wheel/Run.pm
  80. 1,603  poe/lib/POE/Wheel/SocketFactory.pm
  81. 47  poe/mylib/Devel/Null.pm
  82. 71  poe/mylib/Makefile-5004.pm
  83. 144  poe/mylib/Makefile-5005.pm
  84. 44  poe/mylib/MyOtherFreezer.pm
  85. 106  poe/mylib/PoeBuildInfo.pm
  86. 115  poe/mylib/coverage.perl
  87. 179  poe/mylib/cpan-test.perl
  88. 79  poe/mylib/events_per_second.pl
  89. 46  poe/mylib/gen-meta.perl
  90. 119  poe/mylib/gen-tests.perl
  91. 14  poe/mylib/preprocessor.perl
  92. 339  poe/mylib/svn-log.perl
  93. 9  poe/t/00_info.t
  94. 7  poe/t/10_units/01_pod/01_pod.t
  95. 68  poe/t/10_units/01_pod/02_pod_coverage.t
  96. 9  poe/t/10_units/02_pipes/01_base.t
  97. 56  poe/t/10_units/02_pipes/02_oneway.t
  98. 80  poe/t/10_units/02_pipes/03_twoway.t
  99. 40  poe/t/10_units/03_base/01_poe.t
  100. 11  poe/t/10_units/03_base/03_component.t
  101. 15  poe/t/10_units/03_base/04_driver.t
  102. 15  poe/t/10_units/03_base/05_filter.t
  103. 11  poe/t/10_units/03_base/06_loop.t
  104. 15  poe/t/10_units/03_base/07_queue.t
  105. 11  poe/t/10_units/03_base/08_resource.t
  106. 98  poe/t/10_units/03_base/09_resources.t
  107. 33  poe/t/10_units/03_base/10_wheel.t
  108. 451  poe/t/10_units/03_base/11_assert_usage.t
  109. 165  poe/t/10_units/03_base/12_assert_retval.t
  110. 68  poe/t/10_units/03_base/13_assert_data.t
  111. 35  poe/t/10_units/03_base/14_kernel.t
  112. 88  poe/t/10_units/03_base/15_kernel_internal.t
  113. 8  poe/t/10_units/03_base/16_explicit_loop.t
  114. 14  poe/t/10_units/03_base/17_explicit_loop_fail.t
  115. 64  poe/t/10_units/03_base/18_nfa_usage.t
  116. 296  poe/t/10_units/04_drivers/01_sysrw.t
  117. 142  poe/t/10_units/05_filters/01_block.t
  118. 110  poe/t/10_units/05_filters/02_grep.t
  119. 446  poe/t/10_units/05_filters/03_http.t
  120. 195  poe/t/10_units/05_filters/04_line.t
  121. 68  poe/t/10_units/05_filters/05_map.t
  122. 110  poe/t/10_units/05_filters/06_recordblock.t
3  poe-test-loops/MANIFEST
@@ -31,8 +31,9 @@ lib/POE/Test/Loops/wheel_sf_udp.pm
31 31
 lib/POE/Test/Loops/wheel_sf_unix.pm
32 32
 lib/POE/Test/Loops/wheel_tail.pm
33 33
 lib/POE/Test/Loops/z_kogman_sig_order.pm
  34
+lib/POE/Test/Loops/z_leolo_wheel_run.pm
34 35
 lib/POE/Test/Loops/z_merijn_sigchld_system.pm
35  
-# TODO - Why does this segfault for others: lib/POE/Test/Loops/z_rt39872_sigchld.pm
  36
+lib/POE/Test/Loops/z_rt39872_sigchld.pm
36 37
 lib/POE/Test/Loops/z_rt39872_sigchld_stop.pm
37 38
 lib/POE/Test/Loops/z_steinert_signal_integrity.pm
38 39
 t/01_no_tests.t
2  poe/t/90_regression/leolo-poe-wheel-run.t → ...est-loops/lib/POE/Test/Loops/z_leolo_wheel_run.pm
@@ -117,3 +117,5 @@ sub spawn
117 117
         }
118 118
     );
119 119
 }
  120
+
  121
+1;
464  poe/HISTORY
... ...
@@ -1,464 +0,0 @@
1  
-$Id$
2  
-
3  
-A brief, pointless history of POE's evolution.
4  
-
5  
--------------------------------------------------------------------------------
6  
-
7  
-Received: from sinistar.idle.com (sinistar.idle.com [198.109.160.36])
8  
-        by anshar.shadow.net (8.7.3/8.7.3) with ESMTP id JAA05315
9  
-        for <troc@shadow.net>; Fri, 7 Feb 1997 09:59:05 -0500 (EST)
10  
-Received: (from slist@localhost) by sinistar.idle.com (8.7.5/8.7.3)
11  
-        id JAA12501; Fri, 7 Feb 1997 09:00:15 -0500 (EST)
12  
-Resent-Date: Fri, 7 Feb 1997 09:00:15 -0500 (EST)
13  
-Message-Id: <199702071400.JAA00295@anshar.shadow.net>
14  
-From: "Rocco Caputo" <troc@shadow.net>
15  
-To: "Felix Gallo" <fgallo@wellspring.us.dg.com>,
16  
-        "perl5-porters@perl.org" <perl5-porters@perl.org>
17  
-Date: Fri, 07 Feb 97 08:54:23 -0400
18  
-Reply-To: "Rocco Caputo" <troc@shadow.net>
19  
-Priority: Normal
20  
-Subject: portable multithreading
21  
-Resent-Message-ID: <"O2kshC.A.W5C.lTz-y"@sinistar>
22  
-Resent-From: perl5-porters@perl.org
23  
-X-Mailing-List: <perl5-porters@perl.org> archive/latest/135
24  
-X-Loop: perl5-porters@perl.org
25  
-Precedence: list
26  
-Resent-Sender: perl5-porters-request@perl.org
27  
-Content-Type: text
28  
-Content-Length: 3989
29  
-Status:   
30  
-
31  
-On Thu, 06 Feb 1997 12:52:56 +0000, Felix Gallo wrote:
32  
-
33  
->Felix's Perl-related Metaproblems:
34  
->
35  
->1.  Perl is not event-driven, so programs which wish
36  
->to make objects available to the network must manually
37  
->interrupt their control flow to determine if a remote
38  
->object transaction request is pending.
39  
-
40  
-I'm writing a MUD in perl.  The object language faces
41  
-some of the same issues as perl, but I think there are
42  
-ways around them (in the MUD language and in perl).  In
43  
-the MUD server, objects' methods must be compiled into
44  
-perl bytecode.  They must be multitasked/multithreaded
45  
-so that bad code won't hang the server, and object
46  
-authors usually should not have to think about events.
47  
-
48  
-For example, this "bad" MUD code will be legal.  Don't
49  
-worry, I move on to perl in just a minute.
50  
-
51  
-  count = 10000000
52  
-  while count--
53  
-    say "hello, world!  enter some text: "
54  
-    getline some_text
55  
-    if some_text eq 'quit'
56  
-      last
57  
-    endif
58  
-  endwhile
59  
-  say "\ngoodbye, world!\n"
60  
-
61  
-This needs to be compiled to perl bytecode at runtime.
62  
-The MUD bytecode compiler first parses and syntax
63  
-checks an object's source.  If everything passes, it
64  
-builds a perl sub definition in a string.  This
65  
-sub-in-a-string is treated as an assembly language for
66  
-perl bytecode.  The server runs eval() to assemble the
67  
-string-o-perl into bytecodes, and then the resulting sub
68  
-can be called over and over without additional eval()
69  
-overhead.  (Thanks, Silmaril!)
70  
-
71  
-Making that bad loop work in an event-driven server is
72  
-a little harder than making bytecodes.  The MUD compiler
73  
-will build perl assembly as event-driven state machines.
74  
-It can do this by noting the locations of branch
75  
-destinations and returns from blocking calls.  Each of
76  
-these locations starts a new atomic "state", and an
77  
-"instruction pointer" determines which state to run next.
78  
-
79  
-Here's the event-driven perl "assembly" for that sample
80  
-MUD code.  It's not very efficient, but it serves for
81  
-illustration.
82  
-
83  
-  sub aaaaa {
84  
-    # assumes the existence of a tasking/event kernel
85  
-    my $task = shift;
86  
-    my $namespace = $task->{"namespace"};
87  
-    my $ip = $task->{'instruction pointer'}; # state
88  
-
89  
-    # initial entry point
90  
-    if ($ip == 0) {
91  
-      $namespace->{'count'} = 10000000 ;
92  
-      $task->{'instruction pointer'} = 1;
93  
-    }
94  
-    # top of while loop
95  
-    elsif ($ip == 1) {
96  
-      if ( $namespace->{'count'} -- ) {
97  
-        $task->say( qq(hello, world!  enter some text: ) ) ;
98  
-        # soft block on 'getline'
99  
-        $task->{'blocking'} = 'getline';
100  
-        $task->{'instruction pointer'} = 2;
101  
-      }
102  
-      else {
103  
-        $task->{'instruction pointer'} = 3;
104  
-      }
105  
-    }
106  
-    # "return" from getline
107  
-    elsif ($ip == 2) {
108  
-      $namespace->{'some_text'} = $task->getline();
109  
-      if ( $namespace->{'some_text'} eq q(quit) ) {
110  
-        $task->{'instruction pointer'} = 3;
111  
-      }
112  
-      else {
113  
-        $task->{'instruction pointer'} = 1;
114  
-      }
115  
-    }
116  
-    # after endwhile
117  
-    elsif ($ip == 3) {
118  
-      $task->say( qq(\ngoodbye, world!\n) ) ;
119  
-      $task->{'instruction pointer'} = -1; # signals end
120  
-    }
121  
-  }
122  
-
123  
-The main select/event loop would have some code to run tasks
124  
-round-robin.  Something like this, but probably including code
125  
-to deal with priorities.
126  
-
127  
-  if ($next = shift(@task_queue)) {
128  
-    if (($next->{'blocking'}) || ($next->run() != -1)) {
129  
-      push(@task_queue, $next);
130  
-    }
131  
-    else {
132  
-      undef $next;
133  
-    }
134  
-  }
135  
-
136  
-And starting a new task might look like this:
137  
-
138  
-  $task = new Task($tasking_kernel, "count =  ...  world!\n");
139  
-  if ($task->has_errors()) {
140  
-    $task->display_errors();
141  
-    undef $task;
142  
-  }
143  
-  # otherwise the task has been compiled and registered
144  
-  # with the $tasking_kernel
145  
-
146  
-Anyway, that's how I'm writing portable multitasking for a
147  
-syntactically simple MUD language.  To make this work for
148  
-perl, there would be a standard tasking package, and perl's
149  
-bytecode compiler would need to modify its output to work
150  
-with the package.  Sort of like how the perl debugger works.
151  
-
152  
-Just some ideas to ponder.
153  
-
154  
-Rocco
155  
-<troc@shadow.net>
156  
-
157  
--------------------------------------------------------------------------------
158  
-
159  
-Received: from sinistar.idle.com ([198.109.160.36])
160  
-        by anshar.shadow.net (8.8.5/8.7.3) with ESMTP id VAA13861
161  
-        for <troc@shadow.net>; Mon, 14 Apr 1997 21:04:07 -0400 (EDT)
162  
-Received: (from slist@localhost) by sinistar.idle.com (8.7.5/8.7.3)
163  
-        id UAA24149; Mon, 14 Apr 1997 20:37:16 -0400 (EDT)
164  
-Resent-Date: Mon, 14 Apr 1997 20:37:16 -0400 (EDT)
165  
-Message-Id: <199704150040.UAA11517@anshar.shadow.net>
166  
-From: "Rocco Caputo" <troc@shadow.net>
167  
-To: "Gary Howland" <gary@systemics.com>,
168  
-        "Tom Christiansen" <tchrist@jhereg.perl.com>
169  
-Cc: "Gary Howland" <gary@systemics.com>, "Hugo van der Sanden" <hv@iii.co.uk>,
170  
-        "hv@tyree.iii.co.uk" <hv@tyree.iii.co.uk>,
171  
-        "perl5-porters@perl.org" <perl5-porters@perl.org>
172  
-Date: Mon, 14 Apr 97 20:34:01 -0500
173  
-Reply-To: "Rocco Caputo" <troc@shadow.net>
174  
-Priority: Normal
175  
-MIME-Version: 1.0
176  
-Content-Transfer-Encoding: 7bit
177  
-Subject: Re: Perl5.005 wish list (event loop)
178  
-Resent-Message-ID: <"99mWD.A.PzF.i0sUz"@sinistar>
179  
-Resent-From: perl5-porters@idle.com
180  
-X-Mailing-List: <perl5-porters@idle.com> archive/latest/6171
181  
-X-Loop: perl5-porters@idle.com
182  
-Precedence: list
183  
-Resent-Sender: perl5-porters-request@idle.com
184  
-Content-Type: text/plain; charset="iso-8859-1"
185  
-Content-Length: 1119
186  
-Status:   
187  
-
188  
-Gary, et al,
189  
-
190  
-Almost a year ago, I quietly announced something called "Serv + Face".
191  
-Maybe my announcement was a little too quiet.
192  
-
193  
-Serv is a fork-less, select-based framework of event server classes.
194  
-It provides a high level interface to select(), and a very high level
195  
-interface to TCP client and server socket operations.  It does not fork.
196  
-
197  
-Face is the start of a curses-based UI framework that can run alone
198  
-or use Serv as its main loop.
199  
-
200  
-The code and a rough draft of the documentation are available from
201  
-<http://www.shadow.net/~troc/perlstuff.html>.  If this code is useful
202  
-to anyone, I'd sure like to know.
203  
-
204  
-Rocco
205  
-<troc@shadow.net>
206  
-
207  
-On Tue, 15 Apr 1997 01:36:35 +0200, Gary Howland wrote:
208  
->
209  
->Select is fine.  What we (the "event evangelists") want is a "level above" 
210  
->select.  When we have a chunk of data to send to x streams, we don't want to 
211  
->have to call select, see which stream is ready for writing, work out how
212  
->many bytes we can send, send those bytes, shorten our buffers by that amount
213  
->of bytes, and loop back to select.  We just want to send the data.  And we
214  
->want to do this without forking.
215  
-
216  
--------------------------------------------------------------------------------
217  
-
218  
-Received: from sinistar.idle.com (sinistar.idle.com [198.109.160.36])
219  
-        by anshar.shadow.net (8.7.3/8.7.3) with ESMTP id JAA04948
220  
-        for <troc@shadow.net>; Fri, 7 Feb 1997 09:54:31 -0500 (EST)
221  
-Received: (from slist@localhost) by sinistar.idle.com (8.7.5/8.7.3)
222  
-        id JAA12519; Fri, 7 Feb 1997 09:00:19 -0500 (EST)
223  
-Resent-Date: Fri, 7 Feb 1997 09:00:19 -0500 (EST)
224  
-Message-Id: <199702071400.JAA00339@anshar.shadow.net>
225  
-From: "Rocco Caputo" <troc@shadow.net>
226  
-To: "Felix Gallo" <fgallo@wellspring.us.dg.com>,
227  
-        "perl5-porters@perl.org" <perl5-porters@perl.org>
228  
-Date: Fri, 07 Feb 97 08:54:31 -0400
229  
-Reply-To: "Rocco Caputo" <troc@shadow.net>
230  
-Priority: Normal
231  
-Subject: polytheistic perl references
232  
-Resent-Message-ID: <"1y3hHB.A.w5C.sTz-y"@sinistar>
233  
-Resent-From: perl5-porters@perl.org
234  
-X-Mailing-List: <perl5-porters@perl.org> archive/latest/136
235  
-X-Loop: perl5-porters@perl.org
236  
-Precedence: list
237  
-Resent-Sender: perl5-porters-request@perl.org
238  
-Content-Type: text
239  
-Content-Length: 1502
240  
-Status:   
241  
-
242  
-On Thu, 06 Feb 1997 12:52:56 +0000, Felix Gallo wrote:
243  
-
244  
->Felix's Perl-related Metaproblems:
245  
->
246  
->3.  Perl references are monotheistic.  One fancies that saying
247  
->$x = \{ http://perl.com/myperlobject }; would do the right thing,
248  
->but the established structure of Perl seems to make this difficult.
249  
-
250  
-There are tied hash packages that implement object naming
251  
-and message passing between named objects within the same
252  
-process.  The packages allow invocations like:
253  
-
254  
-  $msg{'desktop,paint'} = 1;
255  
-  $msg{'name entry,value'} = 'J. K. Cohen';
256  
-  $active_flag = $msg{'active checkbox,value'};
257  
-
258  
-The packages also do broadcasting to subsets of the object
259  
-dictionary.  Hash stores and fetches are sent to or taken
260  
-from all the objects that match the supplied name.  So to
261  
-clear the value of all objects that have 'entry' in their
262  
-names:
263  
-
264  
-  $msg{'entry,value'} = '';
265  
-
266  
-That clears 'name entry' and 'age entry' and 'salary entry'
267  
-and ....
268  
-
269  
-Anyway, the names could be extended to work across sockets
270  
-in the presence of a standard select/event loop:
271  
-
272  
-  $gnats_queue = $msg{'//somewhere.com:4242/stickynote/gnat?count'};
273  
-  print "gnat has $gnats_queue unread sticky notes.\n";
274  
-
275  
-  $message = 'hello, world!';
276  
-  $msg{'//somewhere.org:4242/stickynote/merlyn?queue'} = $message;
277  
-
278  
-Man pages for ObjDict::Names and ObjDict::Messages are
279  
-on-line at <http://www.nexi.com/troc>.  The code is inside
280  
-a larger package, Serv+Face, at
281  
-<http://www.shadow.net/~troc/perlstuff.html>.
282  
-
283  
-Just some ideas to ponder.
284  
-
285  
-Rocco
286  
-<troc@shadow.net>
287  
-
288  
--------------------------------------------------------------------------------
289  
-
290  
-This is a header from a program I was writing before I discovered Perl.
291  
-
292  
-// =========================================================================
293  
-//  UBERSYS.H
294  
-//   UberSys definitions and classes.
295  
-// =========================================================================
296  
-
297  
-#include <io.h>
298  
-#include <dir.h>
299  
-#include <dos.h>
300  
-#include <math.h>
301  
-#include <time.h>
302  
-#include <alloc.h>
303  
-#include <conio.h>
304  
-#include <ctype.h>
305  
-#include <fcntl.h>
306  
-#include <share.h>
307  
-#include <stdio.h>
308  
-#include <setjmp.h>
309  
-#include <stdarg.h>
310  
-#include <stddef.h>
311  
-#include <stdlib.h>
312  
-#include <string.h>
313  
-#include <values.h>
314  
-#include <fstream.h>
315  
-#include <iomanip.h>
316  
-#include <iostream.h>
317  
-#include <sys\stat.h>
318  
-
319  
-// -------------------------------------------------------------------------
320  
-// Constants, limits, and the like.
321  
-
322  
-#define SIZE_UID        9                       // including NULL terminator
323  
-#define SIZE_PWD        26                      // including NULL terminator
324  
-#define SIZE_MAXSTR     0x1000                  // 4k string sizes (max)
325  
-#define SIZE_MAXPATH    0x0050                  // 160 chars for max path
326  
-#define SIZE_MAXLINE    0x00A0                  // 160 characters per line
327  
-#define COUNT_LINES     0x0200                  // 512 editor lines
328  
-
329  
-#define USREV           0x0200                  // version 02.00
330  
-
331  
-#define DRV             "D:"                    // drive it runs on
332  
-
333  
-// -------------------------------------------------------------------------
334  
-// Helper macros.
335  
-                                        // build a 20-bit address from segoff
336  
-#define A20(x)  (((ULI)FP_SEG(x)<<4)+(ULI)FP_OFF(x))
337  
-                                        // make a normalized pointer from A20
338  
-#define A32(x)  MK_FP((UINT)((x)>>4), (UINT)((x)&0x0F))
339  
-                                        // normalize a far pointer using A20
340  
-#define NORM(x) A32(A20(x))
341  
-                                        // maximum of two values
342  
-template <class T>
343  
-T max(T x, T y)
344  
-{
345  
-        return((x>y)?x:y);
346  
-};
347  
-                                        // minimum of two values
348  
-template <class T>
349  
-T min(T x, T y)
350  
-{
351  
-        return((x<y)?x:y);
352  
-};
353  
-                                        // inline assembly shorthand
354  
-#define I asm
355  
-
356  
-#define FATAL fatalerr(thisFile,__LINE__)
357  
-#define FATALH(x) fatalerr(x,__LINE__)
358  
-
359  
-#if defined(DEBUG)
360  
-#   define ERRS             if(errorstream)*errorstream<<setiosflags(ios::uppercase)<<hex
361  
-#   define CRV(x)           if((x)==RV_FAILURE)FATAL
362  
-#   define CNE(x)           if((x)==-1)FATAL
363  
-#   define CZE(x)           if(!(x))FATAL
364  
-#   define FLINE            ,thisFile,__LINE__
365  
-#   define FLINC            thisFile,__LINE__
366  
-#   define FLINP            , char *file, int line
367  
-#   define FLINQ            char *file, int line
368  
-#   define FLINI            ,file,line
369  
-#   define FLINJ            file,line
370  
-#   define FLINS            thisFile,__LINE__,
371  
-#   define FLINT            char *file, int line,
372  
-#   define FLI              dec<<");\t\t// f:"<<setw(12)<<file<<" @ l:"<<setw(4)<<line
373  
-#   define BOTH(x)          A20(x)<<" ["<<A20(*(x))<<"]"
374  
-#   define DEB(x)           x
375  
-#   define DEB2(x,y)        x,y
376  
-#   define NEW              ERRS<<dec<<"\nCall to new.\t\t\t\t\t// f:"<<setw(12)<<thisFile<<" @ l:"<<setw(4)<<__LINE__;
377  
-#   define DEL              ERRS<<dec<<"\nCall to delete.\t\t\t\t\t// f:"<<setw(12)<<thisFile<<" @ l:"<<setw(4)<<__LINE__;
378  
-#   define WHEREAMI         ERRS<<dec<<"\nInside file "<<thisFile<<" @ line "<<__LINE__;
379  
-#   define ORPHANS          { ERRS<<dec<<"\nOrphan check in "<<thisFile<<" @ line "<<__LINE__<<". "; CRV(aOrphans(FLINC)); }
380  
-#   define VALID(dp)        CZE(aValid(aHeader(dp)));
381  
-#   define DUMP             aDump(FLINC);
382  
-#else
383  
-#   define ERRS             cerr
384  
-#   define CRV(x)           x
385  
-#   define CNE(x)           x
386  
-#   define FLINE
387  
-#   define FLINC
388  
-#   define FLINP
389  
-#   define FLINQ            void
390  
-#   define FLINI
391  
-#   define FLINJ
392  
-#   define FLINS
393  
-#   define FLINT
394  
-#   define DEB(x)
395  
-#   define DEB2(x,y)
396  
-#   define NEW
397  
-#   define DEL
398  
-#   define WHEREAMI
399  
-#   define ORPHANS
400  
-#   define VALID(dp)
401  
-#   define DUMP
402  
-#endif
403  
-
404  
-#define FALSE 0
405  
-#define TRUE (~FALSE)
406  
-
407  
-// -------------------------------------------------------------------------
408  
-
409  
-void fatalerr(char *file, int line);
410  
-
411  
-extern char *buildbuf;
412  
-
413  
-// -------------------------------------------------------------------------
414  
-                                        // Paradox Engine header
415  
-#include "pxengine.h"
416  
-                                        // Error stream if debugging.
417  
-DEB(extern ofstream *errorstream;)
418  
-                                        // Message file header.
419  
-#include "general.h"
420  
-                                        // Type definitions.
421  
-#include "mytypes.h"
422  
-                                        // Database functions.
423  
-#include "pxe.h"
424  
-#include "users.h"
425  
-#include "ipx.h"
426  
-                                        // Code groups.
427  
-#include "pcodes.h"
428  
-#include "gsbl.h"
429  
-#include "arena.h"
430  
-#include "interrup.h"
431  
-#include "port.h"
432  
-#include "msgfile.h"
433  
-#include "task.h"
434  
-#include "tam.h"
435  
-#include "qualpath.h"
436  
-#include "xmm.h"
437  
-#include "var.h"
438  
-#include "safepxi.h"
439  
-#include "template.h"
440  
-#include "token.h"
441  
-#include "stack.h"
442  
-#include "objfile.h"
443  
-#include "ofm.h"
444  
-#include "srcfile.h"
445  
-#include "pmachine.h"
446  
-                                        // BBS modules.
447  
-#include "hangup.h"
448  
-#include "idle.h"
449  
-#include "login.h"
450  
-#include "editor.h"
451  
-#include "cmdline.h"
452  
-#include "console.h"
453  
-#include "dirlist.h"
454  
-#include "compiler.h"
455  
-#include "disasm.h"
456  
-#include "runtime.h"
457  
-
458  
-// -------------------------------------------------------------------------
459  
-
460  
-extern TAM *tam;
461  
-
462  
--------------------------------------------------------------------------------
463  
-
464  
-Light was let be.
153  poe/MANIFEST
... ...
@@ -1,153 +0,0 @@
1  
-CHANGES
2  
-HISTORY
3  
-lib/POE.pm
4  
-lib/POE/Component.pm
5  
-lib/POE/Component/Client/TCP.pm
6  
-lib/POE/Component/Server/TCP.pm
7  
-lib/POE/Driver.pm
8  
-lib/POE/Driver/SysRW.pm
9  
-lib/POE/Filter.pm
10  
-lib/POE/Filter/Block.pm
11  
-lib/POE/Filter/Grep.pm
12  
-lib/POE/Filter/HTTPD.pm
13  
-lib/POE/Filter/Line.pm
14  
-lib/POE/Filter/Map.pm
15  
-lib/POE/Filter/RecordBlock.pm
16  
-lib/POE/Filter/Reference.pm
17  
-lib/POE/Filter/Stackable.pm
18  
-lib/POE/Filter/Stream.pm
19  
-lib/POE/Kernel.pm
20  
-lib/POE/Loop.pm
21  
-lib/POE/Loop/Event.pm
22  
-lib/POE/Loop/Gtk.pm
23  
-lib/POE/Loop/IO_Poll.pm
24  
-lib/POE/Loop/PerlSignals.pm
25  
-lib/POE/Loop/Select.pm
26  
-lib/POE/Loop/Tk.pm
27  
-lib/POE/Loop/TkActiveState.pm
28  
-lib/POE/Loop/TkCommon.pm
29  
-lib/POE/NFA.pm
30  
-lib/POE/Pipe.pm
31  
-lib/POE/Pipe/OneWay.pm
32  
-lib/POE/Pipe/TwoWay.pm
33  
-lib/POE/Queue.pm
34  
-lib/POE/Queue/Array.pm
35  
-lib/POE/Resource.pm
36  
-lib/POE/Resource/Aliases.pm
37  
-lib/POE/Resource/Events.pm
38  
-lib/POE/Resource/Extrefs.pm
39  
-lib/POE/Resource/FileHandles.pm
40  
-lib/POE/Resource/Sessions.pm
41  
-lib/POE/Resource/SIDs.pm
42  
-lib/POE/Resource/Signals.pm
43  
-lib/POE/Resource/Statistics.pm
44  
-lib/POE/Resources.pm
45  
-lib/POE/Session.pm
46  
-lib/POE/Wheel.pm
47  
-lib/POE/Wheel/Curses.pm
48  
-lib/POE/Wheel/FollowTail.pm
49  
-lib/POE/Wheel/ListenAccept.pm
50  
-lib/POE/Wheel/ReadLine.pm
51  
-lib/POE/Wheel/ReadWrite.pm
52  
-lib/POE/Wheel/Run.pm
53  
-lib/POE/Wheel/SocketFactory.pm
54  
-Makefile.PL
55  
-MANIFEST			This list of files
56  
-MANIFEST.SKIP
57  
-META.yml
58  
-mylib/coverage.perl
59  
-mylib/cpan-test.perl
60  
-mylib/Devel/Null.pm
61  
-mylib/events_per_second.pl
62  
-mylib/gen-meta.perl
63  
-mylib/gen-tests.perl
64  
-mylib/Makefile-5004.pm
65  
-mylib/Makefile-5005.pm
66  
-mylib/MyOtherFreezer.pm
67  
-mylib/PoeBuildInfo.pm
68  
-mylib/svn-log.perl
69  
-README
70  
-examples/create.perl
71  
-examples/fakelogin.perl
72  
-examples/forkbomb.perl
73  
-examples/names.perl
74  
-examples/objmaps.perl
75  
-examples/objsessions.perl
76  
-examples/packagesessions.perl
77  
-examples/queue.perl
78  
-examples/README.samples
79  
-examples/selects.perl
80  
-examples/sessions.perl
81  
-examples/signals.perl
82  
-examples/tcp_watermarks.perl
83  
-examples/thrash.perl
84  
-examples/watermarks.perl
85  
-examples/wheels2.perl
86  
-t/00_info.t
87  
-t/10_units/01_pod/01_pod.t
88  
-t/10_units/01_pod/02_pod_coverage.t
89  
-t/10_units/02_pipes/01_base.t
90  
-t/10_units/02_pipes/02_oneway.t
91  
-t/10_units/02_pipes/03_twoway.t
92  
-t/10_units/03_base/01_poe.t
93  
-t/10_units/03_base/03_component.t
94  
-t/10_units/03_base/04_driver.t
95  
-t/10_units/03_base/05_filter.t
96  
-t/10_units/03_base/06_loop.t
97  
-t/10_units/03_base/07_queue.t
98  
-t/10_units/03_base/08_resource.t
99  
-t/10_units/03_base/09_resources.t
100  
-t/10_units/03_base/10_wheel.t
101  
-t/10_units/03_base/11_assert_usage.t
102  
-t/10_units/03_base/12_assert_retval.t
103  
-t/10_units/03_base/13_assert_data.t
104  
-t/10_units/03_base/14_kernel.t
105  
-t/10_units/03_base/15_kernel_internal.t
106  
-t/10_units/03_base/16_explicit_loop.t
107  
-t/10_units/03_base/17_explicit_loop_fail.t
108  
-t/10_units/03_base/18_nfa_usage.t
109  
-t/10_units/04_drivers/01_sysrw.t
110  
-t/10_units/05_filters/01_block.t
111  
-t/10_units/05_filters/02_grep.t
112  
-t/10_units/05_filters/03_http.t
113  
-t/10_units/05_filters/04_line.t
114  
-t/10_units/05_filters/05_map.t
115  
-t/10_units/05_filters/06_recordblock.t
116  
-t/10_units/05_filters/07_reference.t
117  
-t/10_units/05_filters/08_stream.t
118  
-t/10_units/05_filters/50_stackable.t
119  
-t/10_units/05_filters/99_filterchange.t
120  
-t/10_units/05_filters/TestFilter.pm
121  
-t/10_units/06_queues/01_array.t
122  
-t/10_units/07_exceptions/01_normal.t
123  
-t/10_units/07_exceptions/02_turn_off.t
124  
-t/10_units/07_exceptions/03_not_handled.t
125  
-t/20_resources/00_base/aliases.pm
126  
-t/20_resources/00_base/caller_state.pm
127  
-t/20_resources/00_base/events.pm
128  
-t/20_resources/00_base/extrefs.pm
129  
-t/20_resources/00_base/extrefs_gc.pm
130  
-t/20_resources/00_base/filehandles.pm
131  
-t/20_resources/00_base/sessions.pm
132  
-t/20_resources/00_base/sids.pm
133  
-t/20_resources/00_base/signals.pm
134  
-t/20_resources/00_base/statistics.pm
135  
-t/90_regression/agaran-filter-httpd.t
136  
-t/90_regression/averell-callback-ret.t
137  
-t/90_regression/bingos-followtail.t
138  
-t/90_regression/broeren-win32-nbio.t
139  
-t/90_regression/cfedde-filter-httpd.t
140  
-t/90_regression/ferrari-server-unix.t
141  
-t/90_regression/neyuki_detach.t
142  
-t/90_regression/rt14444-arg1.t
143  
-t/90_regression/rt1648-tied-stderr.t
144  
-t/90_regression/rt19908-merlyn-stop.t
145  
-t/90_regression/rt23181-sigchld-rc.t
146  
-t/90_regression/rt47966-sigchld.t
147  
-t/90_regression/somni-poco-server-tcp.t
148  
-t/90_regression/steinert-passed-wheel.t
149  
-t/90_regression/suzman_windows.t
150  
-t/90_regression/ton-stop-corruption.t
151  
-t/90_regression/whelan-dieprop.t
152  
-t/90_regression/whjackson-followtail.t
153  
-TODO
30  poe/MANIFEST.SKIP
... ...
@@ -1,30 +0,0 @@
1  
-CVS
2  
-\.\#
3  
-\.bak$
4  
-\.cvsignore
5  
-\.gz$
6  
-\.orig$
7  
-\.patch$
8  
-\.ppd$
9  
-\.rej$
10  
-\.rej$
11  
-\.svn
12  
-\.swo$
13  
-\.swp$
14  
-^Makefile$
15  
-^Makefile\.old$
16  
-^POE.ppd$
17  
-^\.
18  
-^_Inline
19  
-^_build
20  
-^blib/
21  
-^comptest
22  
-^cover_db
23  
-^coverage\.report$
24  
-^docs
25  
-^pm_to_blib$
26  
-^poe_report\.xml$
27  
-run_network_tests
28  
-test-output\.err$
29  
-t/[23]0_.*\.t
30  
-~$
78  poe/Makefile.PL
... ...
@@ -1,78 +0,0 @@
1  
-#!/usr/bin/perl
2  
-
3  
-use strict;
4  
-use ExtUtils::MakeMaker;
5  
-use Config;
6  
-
7  
-# Switch to default behavior if STDIN isn't a tty.
8  
-
9  
-unless (-t STDIN) {
10  
-  warn(
11  
-    "\n",
12  
-    "=============================================\n\n",
13  
-    "STDIN is not a terminal.  Assuming --default.\n\n",
14  
-    "=============================================\n\n",
15  
-  );
16  
-  push @ARGV, "--default";
17  
-}
18  
-
19  
-# Remind the user she can use --default.
20  
-
21  
-unless (grep /^--default$/, @ARGV) {
22  
-  warn(
23  
-    "\n",
24  
-    "=============================================\n\n",
25  
-    "Prompts may be bypassed by running:\n",
26  
-    "   $^X $0 --default\n\n",
27  
-    "=============================================\n\n",
28  
-  );
29  
-}
30  
-
31  
-# Should we skip the network tests?
32  
-
33  
-my $prompt = (
34  
-  "Some of POE's tests require a functional network.\n" .
35  
-  "You can skip these tests if you'd like.\n\n" .
36  
-  "Would you like to skip the network tests?"
37  
-);
38  
-
39  
-my $ret = "n";
40  
-if (grep /^--default$/, @ARGV) {
41  
-  print $prompt, " [$ret] $ret\n\n";
42  
-}
43  
-else {
44  
-  $ret = prompt($prompt, "n");
45  
-}
46  
-
47  
-my $marker = 'run_network_tests';
48  
-unlink $marker;
49  
-unless ($ret =~ /^Y$/i) {
50  
-  open(TOUCH,"+>$marker") and close TOUCH;
51  
-}
52  
-
53  
-print "\n";
54  
-
55  
-# Which kind of makefile should we build?
56  
-
57  
-if ($] < 5.005004) {
58  
-  warn(
59  
-    "\n",
60  
-    "===============================================================\n",
61  
-    "\n",
62  
-    "Please upgrade Perl to avoid lapses in support.  Perl 5.005_04\n",
63  
-    "or newer is preferred.  Support for older versions will be\n",
64  
-    "phased out in the future.\n",
65  
-    "\n",
66  
-    "Thank you.\n",
67  
-    "\n",
68  
-    "===============================================================\n",
69  
-    "\n",
70  
-  );
71  
-
72  
-  require "./mylib/Makefile-5004.pm";
73  
-}
74  
-else {
75  
-  require "./mylib/Makefile-5005.pm";
76  
-}
77  
-
78  
-1;
94  poe/README
... ...
@@ -1,94 +0,0 @@
1  
-$Id$
2  
-
3  
---------------------
4  
-Detailed Information
5  
---------------------
6  
-
7  
-POE is bigger than this README.  Please see http://poe.perl.org/ for
8  
-more information.
9  
-
10  
----------------------
11  
-Documentation Roadmap
12  
----------------------
13  
-
14  
-POE includes a lot of documentation.  The main POE man page includes
15  
-references to everything else.
16  
-
17  
-POE has been around for a while.  The CHANGES file has been limited to
18  
-changes in the past year to help keep the distribution size down.
19  
-POE's web site includes a complete change history broken down by
20  
-release.
21  
-
22  
---------------
23  
-Installing POE
24  
---------------
25  
-
26  
-POE can be installed through the CPAN or CPANPLUS shell in the usual
27  
-manner.
28  
-
29  
-  % perl -MCPAN -e shell
30  
-  cpan> install POE
31  
-
32  
-Or
33  
-
34  
-  % cpan -i POE
35  
-
36  
-http://poe.perl.org/?Where_to_Get_POE explains other options for
37  
-obtaining POE, including anonymous Subversion access.
38  
-
39  
-------------
40  
-Test Results
41  
-------------
42  
-
43  
-The CPAN Testers are a group of volunteers who test new CPAN
44  
-distributions on a number of platforms.  You can see their test
45  
-results at: http://testers.cpan.org/search?request=dist&dist=POE
46  
-
47  
-POE's ongoing improvement relies on your feedback.  You file bug
48  
-reports, feature requests, and even success stories by e-mailing
49  
-<bug-POE@rt.cpan.org>.
50  
-
51  
--------------
52  
-Test Coverage
53  
--------------
54  
-
55  
-POE's tests cover a significant portion of the distribution.  A
56  
-thumbnail sketch of POE's test coverage is available, but do not use
57  
-it as an accurate gauge of quality.
58  
-
59  
-  http://poe.perl.org/?POE%27s_test_coverage_report
60  
-
61  
------------
62  
-What POE Is
63  
------------
64  
-
65  
-POE is an event-driven networking and multitasking framework for Perl.
66  
-It has been in active development since 1996, with its first open
67  
-release in 1998.  O'Reilly's "The Perl Conference" (now OSCON's Perl
68  
-track) named POE "Best New Module" in 1999.
69  
-
70  
-POE has been used in mission-critical systems such as internetworked
71  
-financial markets, file systems, commerce and application servers.  It
72  
-has been used in projects ranging from a few lines of code to tens of
73  
-thousands.
74  
-
75  
-POE is compatible with perl versions as old as 5.005_03.  This may
76  
-change as it becomes harder to support old versions of Perl over time.
77  
-
78  
-POE includes an evolving component framework.  Components are
79  
-high-level, modular, reusable pieces of programs.  Several components
80  
-have been published on the CPAN, and more are listed on POE's web
81  
-site.  See: http://search.cpan.org/search?query=POE&mode=dist
82  
-
83  
-POE includes components and libraries for making quick work of network
84  
-clients, servers, and peers.  A simple stand-alone web application
85  
-takes about 30 lines of code, most of which is your own custom logic.
86  
-
87  
-----
88  
-Bye!
89  
-----
90  
-
91  
-Thanks for reading!
92  
-
93  
--- 
94  
-Rocco Caputo / rcaputo@cpan.org / http://poe.perl.org/
20  poe/TODO
... ...
@@ -1,20 +0,0 @@
1  
-$Id$
2  
-
3  
-------------------
4  
-Where Did This Go?
5  
-------------------
6  
-
7  
-The contents of this file have moved to the 'web.  You can find them
8  
-at <http://poe.perl.org/?POE_RFCs>.
9  
-
10  
-POE's web site is live editable by nearly everyone.  Readers can
11  
-quickly patch errors or omissions on the site rather than wait for
12  
-their comments to percolate through e-mail and a maintainer's
13  
-schedule.
14  
-
15  
-Please see <http://poe.perl.org/> for information on acquiring an
16  
-account on the site and setting your editing and viewing preferences.
17  
-
18  
----------------------------
19  
-EOF: Thank you for reading.
20  
----------------------------
17  poe/docs/Makefile
... ...
@@ -1,17 +0,0 @@
1  
-#
2  
-## Build POD docs from emacs outlines.
3  
-## $Id$
4  
-
5  
-all: ../POE.pod ../POE-TODO.pod ../POE-HINTS.pod
6  
-
7  
-../POE.pod: ./POE.outline
8  
-  ./out-out.perl pod  ./POE.outline > ../POE.pod
9  
-  ./out-out.perl html ./POE.outline > ../POE.html
10  
-
11  
-../POE-TODO.pod: ./POE-TODO.outline
12  
-  ./out-out.perl pod  ./POE-TODO.outline > ../POE-TODO.pod
13  
-  ./out-out.perl html ./POE-TODO.outline > ../POE-TODO.html
14  
-
15  
-../POE-HINTS.pod: ./POE-HINTS.outline
16  
-  ./out-out.perl pod  ./POE-HINTS.outline > ../POE-HINTS.pod
17  
-  ./out-out.perl html ./POE-HINTS.outline > ../POE-HINTS.html
55  poe/docs/POE-HINTS.outline
... ...
@@ -1,55 +0,0 @@
1  
-*NAME #® -*- outline -*- ¯
2  
-POE-HINTS - POE Hints
3  
-*DESCRIPTION
4  
-These are hints for using POE.  It's sort of like a faq, only without
5  
-the questions.
6  
-
7  
-**Events and Things
8  
-Events and event-like things can be confusing.  Here are some gotchas
9  
-people have noted.
10  
-
11  
-***Event Names vs. Code References
12  
-The difference between code references and event names may at first be
13  
-confusing.  There have been reports of people trying to use them
14  
-interchangeably, causing lots of mental pain when it doesn't work.
15  
-
16  
-Just about the only time a code reference is needed is when states are
17  
-defined.  After that, states should almost always be referenced by
18  
-event name.
19  
-
20  
-Uh, this doesn't sound very convincing.  I should probably go into it
21  
-in a little more detail in the next revision.
22  
-**Session Resources
23  
-Session resources are things that the session and/or kernel manage
24  
-with high-level functions.  These include alarms, selects and aliases.
25  
-
26  
-Wheels are also considered session resources, because they use
27  
-first-order resources internally.
28  
-
29  
-***Notes About Session Resources
30  
-B®Don't cross the streams.  It would be bad.¯
31  
-
32  
-Session resources are not designed to be manipulated from outside the
33  
-sessions that own them.  One session may not set or remove alarms in
34  
-another.  Nor may sessions set selects on behalf of others.
35  
-
36  
-In the case of wheels, one session may not directly call another's
37  
-wheel's methods.  $some_other_sessions_wheel->put(...) will not work
38  
-as expected.  Internally, the wheel will call &Kernel::select_write;
39  
-this turns on/off a write select in the currently active session--
40  
-which is the caller's session.
41  
-
42  
-The workaround for this is to create a "put" state in the wheel
43  
-owner's session and &Kernel::post or &Kernel::call to that state.  The
44  
-post or call changes the active session to the wheel owner.  The
45  
-&Wheel::put call will then work as expected.
46  
-
47  
-Breaking session encapsulation was not considered during POE's design.
48  
-*AUTHORS
49  
-This document is the result of feedback from POE users.  If you have
50  
-questions or comments that aren't covered by this hints file, please
51  
-contact the author.  Even better, subscribe to the POE mailing list.
52  
-
53  
-This document is Copyright 1999 Rocco Caputo <troc@netrus.net>.  All
54  
-rights reserved.  This document is free text; you may redistribute it
55  
-and/or modify it under the same terms as Perl itself.
1,856  poe/docs/POE-TODO.outline
... ...
@@ -1,1856 +0,0 @@
1  
-* NAME #® -*- outline -*- ¯
2  
-
3  
-POE-TODO - To-Do List for POE
4  
-
5  
-* DESCRIPTION
6  
-
7  
-Random requests, suggestions and ideas.
8  
-
9  
-People who want to implement something for POE should check the latest
10  
-version of this list (to see if anyone has claimed it already), and
11  
-let Rocco know (so they can be added to the list).
12  
-
13  
-Also see the POE mailing list, which tends to be pretty quiet.
14  
-
15  
-* PROBLEMS
16  
-
17  
-** Infinite Loops
18  
-
19  
-The real world has multiple inconsistent event loops, all blocking.
20  
-POE's loop cannot coexist with the others.
21  
-
22  
-Tk and POE could be made to half-cooperate by breaking POE's event
23  
-loop open and allowing polled mode.  POE would register a
24  
-Tk_DoWhenIdle callback, and some other ugliness.
25  
-
26  
-** Blocking
27  
-
28  
-Blocking procedural code is useful, even in an event driven world.
29  
-How to say:
30  
-
31  
-  $line = readline($term);
32  
-
33  
-* MAJOR RESTRUCTURING
34  
-
35  
-I'm considering moving things around in a Big Way.
36  
-
37  
-** New Interface
38  
-
39  
-*** POE::Kernel
40  
-
41  
-In version 0.07, POE::Kernel holds the event queue and manages
42  
-resources that it uses.
43  
-
44  
-The current Kernel's main responsibility is to manage resources.
45  
-Sessions are resources, along with selects, alarms, aliases, signals
46  
-and other things.  The current Kernel also holds POE's event loop.
47  
-
48  
-As more people use POE, the desire to use it for other purposes
49  
-increases.  POE's Kernel, however, was designed for a particular task
50  
-and is too rigid to be used for some things.
51  
-
52  
-There are two main problems with the current kernel.  First, the
53  
-functions that make its programmer interface are too rigid.  It's
54  
-really hard to change them, or to add new functions, because the
55  
-Kernel class is a monolith.  Second, its event queue is hard-coded, so
56  
-it's really difficult to cooperate with something like Tk.
57  
-
58  
-So first, let's make POE::Kernel a generic resource manager:
59  
-
60  
-  package POE::Kernel;
61  
-  use strict;
62  
-
63  
-  my @resources;
64  
-  my @sessions;
65  
-
66  
-  sub RES_NAME   () { 0 }
67  
-  sub RES_FLAGS  () { 1 }
68  
-  sub RES_RECORD () { 2 }
69  
-
70  
-  # Allocate a resource.  That is, let the Kernel know it should
71  
-  # manage the "session uses resource" association for this resource.
72  
-  # It is up to the resource to manage the "resource is used by
73  
-  # session" association.
74  
-
75  
-  sub resource_alloc {
76  
-    my $resource_name = shift;
77  
-    # -><- lock @resources here
78  
-    push @resources, [ $resource_name, \@_, {} ];
79  
-    my $new_resource_id = @resources;
80  
-    # -><- unlock @resources here
81  
-    my $resource_record = $resources[$new_resource_id]->[RES_RECORD];
82  
-    $resources{$resource_record} = $new_resource_id;
83  
-    ( 'resource allocated okay',                 # status
84  
-      $new_resource_id,                          # resource index
85  
-      $resources[$new_resource_id]->[RES_RECORD] # resource record
86  
-    );
87  
-  }
88  
-
89  
-  # Free a resource.  This occurs when the program ends.  It ensures
90  
-  # that session destructors have already cleaned up the references
91  
-  # for each managed resources.
92  
-
93  
-  sub resource_free {
94  
-    my ($resource_id) = @_;
95  
-    my $resource = $resources[$resource_id];
96  
-
97  
-    if (keys %{$resource->[RES_RECORD]}) {
98  
-      carp "leak in $resource->[RES_RECORD]->[RES_NAME] resource";
99  
-    }
100  
-
101  
-    # -><- lock @resources here
102  
-    $resources[$resource_id] = undef;
103  
-    # -><- unlock @resources here
104  
-  }
105  
-
106  
-  # Register a resource instance.  This lets the kernel know that a
107  
-  # particular session uses a specific resource.
108  
-
109  
-  sub resource_associate {
110  
-    my ($resource_id, $resource
111  
-
112  
-**** POE::Resource::Select
113  
-
114  
-The Select resource is somewhat equivalent to the current Kernel's
115  
-select_* functions, but it has different semantics as a "resource"
116  
-instead of a "function library".
117  
-
118  
-  package POE::Resource::Select;
119  
-
120  
-  use strict;
121  
-  use POE::Kernel;
122  
-
123  
-  my $resource_serial = 0;
124  
-  my $resource_record = undef;
125  
-
126  
-  ($status, $resource_record) = &POE::Kernel::resource_alloc( RES_SELECT );
127  
-  die $status unless (defined $resource_record);
128  
-
129  
-  END {
130  
-    # test $resource_record for leaks
131  
-  }
132  
-
133  
-  sub new {
134  
-    my ($package, %params) = @_;
135  
-    my $current_session = &stupid_caller_trick();
136  
-    my $self = $resource_serial++;
137  
-    $self = bless \$self, $package;
138  
-    &POE::Kernel::session_use($current_session, $self);
139  
-    $resource_record->{$self} = [ $current_session ];
140  
-  }
141  
-
142  
-  sub DESTROY {
143  
-    my $self = shift;
144  
-    &POE::Kernel::session_free($self);
145  
-    delete $resource_record{$self};
146  
-  }
147  
-
148  
-  package main;
149  
-
150  
-  use POE;
151  
-  use POE::Resource::Select;
152  
-
153  
-  sub state_start {
154  
-    $id = new POE::Resource::Select(
155  
-      Handle        => $handle,
156  
-      ReadState     => $read_state,
157  
-      WriteState    => $write_state,
158  
-      ExpediteState => $expedite_state,
159  
-    );
160  
-  }
161  
-
162  
-  $id->state( Read     => undef,     # Undef turns it off.
163  
-              Write    => '',        # '' turns it on, using last state
164  
-              Expedite => $new_state # scalar changes the state
165  
-            );
166  
-
167  
-    
168  
-
169  
-**** POE::Kernel as Resource Manager
170  
-
171  
-  package POE::Kernel;
172  
-
173  
-  @resources;
174  
-
175  
-
176  
-**** POE::K
177  
-
178  
-** Current Interface
179  
-
180  
-*** POE::Kernel
181  
-
182  
-The program's event loop and resource management stuff.
183  
-
184  
-  $k = new POE::Kernel();
185  
-
186  
-  $k->sig($signal, $state);
187  
-  $k->signal($session, $signal);
188  
-
189  
-  $k->run();
190  
-
191  
-  $k->post($session, $state, @etc);
192  
-  $k->yield($state, @etc);
193  
-  $k->call($session, $state, @etc);
194  
-
195  
-  $k->alarm($state, $time, @etc);
196  
-  $k->delay($state, $delay, @etc);
197  
-
198  
-  $k->select($handle, $state_r, $state_w, $state_e);
199  
-  $k->select_read($handle, $state);
200  
-  $k->select_write($handle, $state);
201  
-  $k->select_expedite($handle, $state);
202  
-
203  
-  $k->alias_set($name);