----- Forwarded message from [EMAIL PROTECTED] -----
Date: Wed, 19 Apr 2000 18:59:24 +0200
Subject: CPAN Upload: JPRIT/Event-0.74.tar.gz
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED],
[EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
The uploaded file
Event-0.74.tar.gz
has entered CPAN as
file: $CPAN/authors/id/JPRIT/Event-0.74.tar.gz
size: 148100 bytes
md5: 8748c6670e89132a7f1409226e16c46a
No action is required on your part
Request entered by: JPRIT (Joshua N. Pritikin)
Request entered on: Wed, 19 Apr 2000 16:58:26 GMT
Request completed: Wed, 19 Apr 2000 16:59:24 GMT
Virtually Yours,
Id: paused,v 1.68 1999/10/22 14:39:12 k Exp k
----- End forwarded message -----
# This is a patch for Event-0.73 to update it to Event-0.74
#
# To apply this patch:
# STEP 1: Chdir to the source directory.
# STEP 2: Run the 'applypatch' program with this patch file as input.
#
# If you do not have 'applypatch', it is part of the 'makepatch' package
# that you can fetch from the Comprehensive Perl Archive Network:
# http://www.perl.com/CPAN/authors/Johan_Vromans/makepatch-x.y.tar.gz
# In the above URL, 'x' should be 2 or higher.
#
# To apply this patch without the use of 'applypatch':
# STEP 1: Chdir to the source directory.
# If you have a decent Bourne-type shell:
# STEP 2: Run the shell with this file as input.
# If you don't have such a shell, you may need to manually create
# the files as shown below.
# STEP 3: Run the 'patch' program with this file as input.
#
# These are the commands needed to create/delete files/directories:
#
touch 't/data.t'
chmod 0444 't/data.t'
#
# This command terminates the shell and need not be executed manually.
exit
#
#### End of Preamble ####
#### Patch data follows ####
gdiff -up '/usr/tmp/mp5362.d/old/Event-0.73/ChangeLog'
'/usr/tmp/mp5362.d/new/Event-0.74/ChangeLog'
Index: ./ChangeLog
--- ./ChangeLog Fri Mar 24 10:36:44 2000
+++ ./ChangeLog Wed Apr 19 12:43:42 2000
@@ -1,4 +1,16 @@
+2000-04-19 Joshua Pritikin <[EMAIL PROTECTED]>
+
+ * Release 0.74.
+
+ * Resolved data() quandary. Added test.
+
+2000-04-12 Joshua Pritikin <[EMAIL PROTECTED]>
+
+ * Updated perlqt.t example.
+
2000-03-24 Joshua Pritikin <[EMAIL PROTECTED]>
+
+ * Spell checked pod.
* Release 0.73.
gdiff -up '/usr/tmp/mp5362.d/old/Event-0.73/MANIFEST'
'/usr/tmp/mp5362.d/new/Event-0.74/MANIFEST'
Index: ./MANIFEST
--- ./MANIFEST Tue Mar 21 08:38:16 2000
+++ ./MANIFEST Wed Apr 19 12:45:47 2000
@@ -25,12 +25,12 @@ c/var.c
c/watcher.c
demo/echo.t
demo/group.t
+demo/msg.pm
demo/perlqt.t
demo/process.pm
demo/rand_interval.t
demo/readline.t
demo/repeat.t
-demo/msg.pm
demo/semaphore.pm
lib/Event.pm
lib/Event.pod
@@ -49,6 +49,7 @@ ppport.h
t/attach_to.t
t/bored.t
t/callback.t
+t/data.t
t/delete.t
t/eval.t
t/fifo.t
gdiff -up '/usr/tmp/mp5362.d/old/Event-0.73/demo/perlqt.t'
'/usr/tmp/mp5362.d/new/Event-0.74/demo/perlqt.t'
Index: ./demo/perlqt.t
--- ./demo/perlqt.t Fri Feb 18 16:04:59 2000
+++ ./demo/perlqt.t Wed Apr 12 17:02:31 2000
@@ -2,20 +2,46 @@
use Qt 2.0;
use Event;
-use NetServer::ProcessTop;
+
+package Qt::Application;
+BEGIN { Qt::app->import; } # must happen prior to this override:
+{
+ # Won't work unless these are *virtual* functions. Troll Tech
+ # hasn't yet seen fit to make this change. Apply the attached
+ # patch for qt, and recompile.
+ # Don't forget to make similar adjustments to the PerlQt templates.
+ no warnings;
+ sub enter_loop { Event::loop() }
+ sub exit_loop { Event::unloop() }
+}
package MyMainWindow;
use base 'Qt::MainWindow';
-use Qt::slots 'quit()';
-sub quit {
- Event::unloop(0);
+use Qt::slots 'open_file()';
+sub open_file {
+ # call something that does exec(), and therefore enter_loop()
+ Qt::FileDialog::getExistingDirectory();
}
+use Qt::slots 'quit()';
+sub quit { Event::unloop(0) }
+
package main;
-import Qt::app;
+Qt::app->import;
-Event->io(desc => 'Qt', fd => Qt::xfd(), timeout => .25,
+# Some versions of PerlQt don't provide xfd(). Fortunately, it is
+# easy to add.
+#
+# Qt.pig:
+#
+# #include <qwindefs.h>
+# #include <X11/Xlib.h>
+# static int xfd() : ConnectionNumber(qt_xdisplay());
+
+Event->io(desc => 'Qt',
+ fd => Qt::xfd(),
+ timeout => .2, # for balloon help, etc.
cb => sub {
$app->processEvents(3000); #read
$app->flushX(); #write
@@ -23,17 +49,21 @@ Event->io(desc => 'Qt', fd => Qt::xfd(),
my $w = MyMainWindow->new;
+my $mb = $w->menuBar;
my $file = Qt::PopupMenu->new;
+$file->insertItem("Open...", $w, 'open_file()');
$file->insertItem("Quit", $w, 'quit()');
-my $mb = $w->menuBar;
$mb->insertItem("File", $file);
-my $at = 1000;
+my $at = int rand 1000;
my $label = Qt::Label->new("$at", $w);
$w->setCentralWidget($label);
-Event->timer(interval => .25, cb => sub {
+Event->timer(hard => 1, interval => .2, cb => sub {
--$at;
+ $at = int rand 1000
+ if $at < 1;
+ # prove that Event is in control
$label->setText($at);
});
@@ -43,3 +73,27 @@ $w->show;
$app->setMainWidget($w);
exit Event::loop();
+__END__
+
+diff -c 'qt-2.1.0/src/kernel/qapplication.h' 'qt-2.1.0.new/src/kernel/qapplication.h'
+*** ././src/kernel/qapplication.h Wed Apr 12 09:21:53 2000
+--- ././src/kernel/qapplication.h Wed Apr 12 13:53:51 2000
+***************
+*** 112,119 ****
+ void processEvents();
+ void processEvents( int maxtime );
+ void processOneEvent();
+! int enter_loop();
+! void exit_loop();
+ int loopLevel() const;
+ static void exit( int retcode=0 );
+
+--- 112,119 ----
+ void processEvents();
+ void processEvents( int maxtime );
+ void processOneEvent();
+! virtual int enter_loop();
+! virtual void exit_loop();
+ int loopLevel() const;
+ static void exit( int retcode=0 );
+
gdiff -up '/usr/tmp/mp5362.d/old/Event-0.73/lib/Event.pm'
'/usr/tmp/mp5362.d/new/Event-0.74/lib/Event.pm'
Index: ./lib/Event.pm
--- ./lib/Event.pm Fri Mar 24 10:37:09 2000
+++ ./lib/Event.pm Wed Apr 19 12:43:26 2000
@@ -13,7 +13,7 @@ use Carp;
eval { require Carp::Heavy; }; # work around perl_call_pv bug XXX
use vars qw($VERSION @EXPORT_OK
$API $DebugLevel $Eval $DIED $Now);
-$VERSION = '0.73';
+$VERSION = '0.74';
# If we inherit DynaLoader then we inherit AutoLoader; Bletch!
require DynaLoader;
gdiff -up '/usr/tmp/mp5362.d/old/Event-0.73/lib/Event.pod'
'/usr/tmp/mp5362.d/new/Event-0.74/lib/Event.pod'
Index: ./lib/Event.pod
--- ./lib/Event.pod Tue Mar 14 08:17:34 2000
+++ ./lib/Event.pod Wed Apr 19 08:17:47 2000
@@ -23,7 +23,7 @@ priority order when it is safe for callb
=head1 PERL API
-Events (the occurance of such) are noticed and queued by 'event
+Events (the occurrence of such) are noticed and queued by 'event
watchers'. The creation and configuration of event watchers is the
primary topic of the rest of this document.
@@ -167,7 +167,7 @@ watchers.
=item $watcher->again
This is the same as the C<start> except if a watcher has special
-repeat behavior. For example, repeating timers recalcuate their alarm
+repeat behavior. For example, repeating timers recalculate their alarm
time using the C<interval> parameter.
=item $watcher->now
@@ -303,7 +303,7 @@ equal priority are serviced in first-in-
PRIO_HIGH PRIO_NORMAL
A negative priority causes the callback to be invoked immediately upon
-event occurance. Use this with caution. While it may seem
+event occurrence. Use this with caution. While it may seem
advantageous to use negative priorities, they bypass the whole point
of having an event queue.
@@ -372,6 +372,11 @@ for this purpose. See the full descript
When the callback was invoked most recently.
+=item data => $anything
+
+Use the C<data()> method to associate arbitrary data with a watcher.
+Each caller's package accesses its own private data attribute.
+
=item debug => $bool
Debugging can be activated globally or per watcher. When debugging is
@@ -607,12 +612,12 @@ Threads can either substitute for an eve
Threads are similar to processes in that the operating system manages
task switching for you. However, the difference is that all threads
share the same address space. This is good and bad. Higher
-performance can be acheived but since data is shared between threads,
+performance can be achieved but since data is shared between threads,
extreme care must be taken to access or modify global data. The
operating system can switch threads at any moment or can execute
-multiple threads simultaineously. I hope this sounds dangerous! It
+multiple threads simultaneously. I hope this sounds dangerous! It
is! Threads can introduce maddeningly complicated and hard to debug
-syncronization problems.
+synchronization problems.
Threads are like rocket fuel. They are essential when you really need
them but most applications would be better off with a simple event
@@ -691,7 +696,7 @@ Even if this module does not end up bein
the author will insure that it is source compatible with its
successor, or arrange for gradual migration. Back in the early days,
the Event programming API was changing at every release. Care was
-taken to allow the old API to continue to work, and the transistion
+taken to allow the old API to continue to work, and the transition
was eased by printing out lots of warnings about the new usage. So
you shouldn't sit on your hands in anticipation of the One and True
Event Loop. Just start coding!
gdiff -up '/usr/tmp/mp5362.d/old/Event-0.73/lib/Event/Watcher.pm'
'/usr/tmp/mp5362.d/new/Event-0.74/lib/Event/Watcher.pm'
Index: ./lib/Event/Watcher.pm
--- ./lib/Event/Watcher.pm Wed Mar 8 11:43:33 2000
+++ ./lib/Event/Watcher.pm Wed Apr 19 08:12:03 2000
@@ -99,8 +99,12 @@ sub configure {
sub data { # assumes $self is a HASH ref
my $self = shift;
- $self->{Event_data} = shift if @_;
- $self->{Event_data};
+ my $pkg = caller;
+ if (@_) {
+ $self->{$pkg} = shift
+ } else {
+ $self->{$pkg};
+ }
}
sub clump {
gdiff -up /dev/null '/usr/tmp/mp5362.d/new/Event-0.74/t/data.t'
Index: ./t/data.t
--- ./t/data.t Wed Dec 31 19:00:00 1969
+++ ./t/data.t Wed Apr 19 12:42:13 2000
@@ -0,0 +1,20 @@
+#!./perl -w
+
+use Test; plan tests => 6;
+use Event;
+
+my $w = Event->idle(parked => 1);
+
+ok !$w->data;
+ok $w->data(1);
+ok $w->data;
+
+package Grapes;
+use Test;
+
+ok !$w->data;
+ok $w->data(2), 2;
+
+package main;
+
+ok $w->data, 1;
#### End of Patch data ####
#### ApplyPatch data follows ####
# Data version : 1.0
# Date generated : Wed Apr 19 13:02:35 2000
# Generated by : makepatch 2.00 (2.0BETA)
# Recurse directories : Yes
# p 'ChangeLog' 24660 956162622 0100444
# p 'MANIFEST' 898 956162747 0100444
# p 'demo/perlqt.t' 775 955573351 0100444
# p 'lib/Event.pm' 4074 956162606 0100444
# p 'lib/Event.pod' 24506 956146667 0100444
# p 'lib/Event/Watcher.pm' 2369 956146323 0100444
# c 't/data.t' 0 956162533 0100444
#### End of ApplyPatch data ####
#### End of Patch kit [created: Wed Apr 19 13:02:35 2000] ####
#### Checksum: 329 10487 40877 ####
--
"May the best description of competition prevail."
via, but not speaking for Deutsche Bank