Merge commit 'origin/master' into HEAD
Steve Scaffidi [Fri, 11 Sep 2009 21:00:46 +0000 (17:00 -0400)]
Conflicts:
.gitignore
BuildStem.pm
MANIFEST
MANIFEST.SKIP
bin/chat2_demo
bin/run_stem

13 files changed:
.gitignore
BuildStem.pm
CREDITS
MANIFEST
MANIFEST.SKIP
bin/chat2_demo
bin/run_stem
lib/Stem/Event.pm
lib/Stem/Event/Perl.pm
lib/Stem/Event/Queue.pm
lib/Stem/Event/Signal.pm
notes/srs_notes.txt [new file with mode: 0644]
t/event/event_test.pl

index 403a422..6af5e59 100644 (file)
@@ -10,7 +10,6 @@ MANIFEST.bak
 _build/
 Build
 Makefile
-lib/
 blib/
 
 # Temp, old and emacs backup files.
@@ -20,3 +19,22 @@ blib/
 .#*
 .*.swp
 
+# archive files
+*.gz
+*.bz2
+
+# stuff from uri's working dir that he doesn't want in the repo
+old*
+*.ok
+lib-pod
+modules
+event_test
+dlug
+flow
+intel
+pod
+scaffidi
+slides
+stem2pod
+test
+
index cceef07..b510809 100644 (file)
@@ -23,6 +23,7 @@ sub process_script_files {
        my $demo_dir   = File::Spec->catdir($self->blib, 'demo');
        File::Path::mkpath( $script_dir );
        File::Path::mkpath( $demo_dir );
+    $self->add_to_cleanup($demo_dir);
 
        foreach my $file (keys %$files) {
                my $dest_dir = $file =~ /_demo$/ ? $demo_dir : $script_dir ;
diff --git a/CREDITS b/CREDITS
index a83b226..130fd45 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -1,3 +1,4 @@
 People besides Uri who've contributed to Stem code and docs:
 
 Dave Rolsky - various code, bug fixes, docs, etc.
+Stephen R. Scaffidi - various bug fixes, docs, etc.
index 76c340d..49403df 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -47,6 +47,7 @@ conf/test_udp.stem
 conf/ticker.stem
 conf/ttysock.stem
 conf/type.stem
+conf/x.stem
 Cookbook/cookbook.txt
 Cookbook/World1.pm
 Cookbook/World2.pm
@@ -158,7 +159,6 @@ sessions/backend.pl
 sessions/client.pl
 sessions/mid_event.pl
 sessions/mid_event_async.pl
-srs_notes.txt
 t/cell/flow.t
 t/config/test_stem_bug.pl
 t/event/event.t
index ac21002..7408d6d 100644 (file)
 ^blib/
 ^MakeMaker-\d
 
+# demo files so we don't need to install
+^demo/
+
 # Temp, old and emacs backup files.
 ~$
 \.old$
 ^#.*#$
 ^\.#
 \.*.swp$
+
+# other stuff we dont want in the dist tarball
+^notes/
+
index 9a4ec6f..1340a79 100755 (executable)
@@ -7,6 +7,10 @@ $xskip = ( $^O eq 'solaris' ) ? 600 : 500 ;
 
 use File::Basename qw( basename );
 $ENV{PATH} .= ':' . basename( $0 ) . ':.';
+<<<<<<< HEAD:bin/chat2_demo
+=======
+
+>>>>>>> origin/master:bin/chat2_demo
 for my $prog qw( run_stem xterm telnet ) {
     die "Can't find $prog in PATH\n" if
         system( "which $prog >/dev/null 2>&1" ) != 0;
index 5ad494a..0dbe445 100755 (executable)
@@ -32,6 +32,7 @@ eval 'exec /usr/bin/perl -w -S $0 ${1+"$@"}'
 
 
 eval { use lib 'blib/lib' } if -d 'blib/lib';
+eval { use lib '../blib/lib' } if -d '../blib/lib';
 
 $Data::Dumper::Indent = 1 ;
 $Data::Dumper::Purity = 1 ;
index bd80857..1df1a00 100644 (file)
@@ -64,14 +64,15 @@ my %loop_to_class = (
 
 my $loop_class = _get_loop_class() ;
 
-init_loop() ;
+INIT{ init_loop() ; }
 
 
 sub init_loop {
 
+Stem::Event::Queue::_init_queue() if defined &Stem::Event::Queue::_init_queue ;
+
        $loop_class->_init_loop() ;
 
-Stem::Event::Queue::_init_queue() if defined &Stem::Event::Queue::_init_queue ;
 
 }
 
@@ -295,19 +296,25 @@ sub _get_loop_class {
        $loop_type = 'perl' unless $loop_to_class{ $loop_type } ;
        my $loop_class = "Stem::Event::$loop_to_class{ $loop_type }" ;
 
+print "LOOP $loop_class\n" ;
+
        unless ( eval "require $loop_class" ) {
                die "can't load $loop_class: $@" if $@ && $@ !~ /locate/ ;
 
+print "not found\n" ;
+
                $loop_type = 'perl' ;
                eval { require Stem::Event::Perl } ;
                die "can't load event loop Stem::Event::Perl $@" if $@ ;
        }
 
+
        # save the event loop that we loaded.
 
        #print "using event loop [$loop_type]\n" ;
        $Stem::Vars::Env{ 'event_loop' } = $loop_type ;
 
+
        return $loop_class ;
 }
 
@@ -315,10 +322,7 @@ sub _get_loop_class {
 ############################################################################
 
 package Stem::Event::Plain ;
-
-BEGIN {
-       @Stem::Event::Plain::ISA = qw( Stem::Event ) ;
-}
+our @ISA = qw( Stem::Event ) ;
 
 =head2 Stem::Event::Plain::new
 
@@ -365,7 +369,7 @@ sub new {
        my $self = Stem::Class::parse_args( $attr_spec_plain, @_ ) ;
        return $self unless ref $self ;
 
-       my $err = $self->_core_event_build( 'plain' ) ;
+       my $err = $self->_build_core_event( 'plain' ) ;
        return $err if $err ;
 
        return $self ;
@@ -374,8 +378,7 @@ sub new {
 ############################################################################
 
 package Stem::Event::Signal ;
-
-BEGIN { our @ISA = qw( Stem::Event ) } ;
+our @ISA = qw( Stem::Event ) ;
 
 =head2 Stem::Event::Signal::new
 
@@ -461,8 +464,7 @@ sub new {
 ############################################################################
 
 package Stem::Event::Timer ;
-
-BEGIN { our @ISA = qw( Stem::Event ) } ;
+our @ISA = qw( Stem::Event ) ;
 
 =head2 Stem::Event::Timer::new
 
@@ -651,8 +653,7 @@ sub timer_triggered {
 # these override Stem::Event's methods and then call those via SUPER::
 
 package Stem::Event::IO ;
-
-BEGIN { our @ISA = qw( Stem::Event ) } ;
+our @ISA = qw( Stem::Event ) ;
 
 sub init_io_timeout {
 
@@ -725,8 +726,9 @@ sub timed_out {
 #######################################################
 
 package Stem::Event::Read ;
+our @ISA = qw( Stem::Event::IO ) ;
+print "B @ISA\n" ;
 
-BEGIN { our @ISA = qw( Stem::Event::IO ) }
 
 =head2 Stem::Event::Read::new
 
@@ -804,10 +806,12 @@ HELP
 sub new {
 
        my( $class ) = shift ;
+print "@ISA\n" ;
 
        my $self = Stem::Class::parse_args( $attr_spec_read, @_ ) ;
        return $self unless ref $self ;
 
+
 #      return <<ERR unless defined fileno $self->{fh} ;
 # Stem::Event::Read: $self->{fh} is not an open handle
 # ERR
@@ -824,8 +828,7 @@ sub new {
 ############################################################################
 
 package Stem::Event::Write ;
-
-BEGIN { our @ISA = qw( Stem::Event::IO ) } ;
+our @ISA = qw( Stem::Event::IO ) ;
 
 =head2 Stem::Event::Write::new
 
index f614da7..6974027 100644 (file)
@@ -35,12 +35,11 @@ API for the standard classes:
 =cut
 
 package Stem::Event::Perl ;
+our @ISA = qw( Stem::Event ) ;
 
 use strict ;
 use Stem::Event::Signal ;
 
-@Stem::Event::Perl::ISA = qw( Stem::Event ) ;
-
 BEGIN {
 
        unless ( eval { require Time::HiRes } ) {
index e6549d9..241bba3 100644 (file)
@@ -41,6 +41,7 @@
 
 
 package Stem::Event::Queue ;
+our @ISA = qw( Stem::Event ) ;
 
 use strict ;
 use warnings ;
@@ -49,7 +50,7 @@ use Socket;
 use IO::Handle ;
 
 use base 'Exporter' ;
-our @EXPORT = qw( &mark_not_empty ) ;
+our @EXPORT = qw( mark_not_empty ) ;
 
 my( $queue_read, $queue_write, $queue_read_event ) ;
 
index c9d723e..14a85ba 100644 (file)
@@ -32,8 +32,8 @@ sub _build {
 
        $SIG{ $signal } = $cached_handlers{$signal} ||=
                sub {
-                       mark_not_empty() ;
-#print "HIT $signal\n";
+print "HIT $signal\n";
+                       Stem::Event::Queue::mark_not_empty() ;
                        push @signal_queue, $signal
                } ;
 
diff --git a/notes/srs_notes.txt b/notes/srs_notes.txt
new file mode 100644 (file)
index 0000000..7b3e6c3
--- /dev/null
@@ -0,0 +1,6 @@
+Odd sort of behavior... when dumping \%:: with Data::Dumper in Stem/Conf.pm
+(insert a print @ line 234)
+
+the program just "freezes"...
+
+
index 11227d1..faefbfe 100644 (file)
@@ -11,8 +11,7 @@ BEGIN {
 
 use strict ;
 
-#use Test::More tests => 29 ;
-use Test::More tests => 24 ;
+use Test::More tests => 27 ;
 
 use Symbol ;
 
@@ -27,9 +26,9 @@ exit ;
 
 sub test_events {
 
-#      test_null_events() ;
-#      test_plain_events () ;
-#      test_signal_events () ;
+       test_null_events() ;
+       test_plain_events () ;
+       test_signal_events () ;
        test_hard_timer_events () ;
        test_soft_timer_events () ;
        test_io_events () ;
@@ -65,6 +64,7 @@ sub triggered {
        my( $self ) = @_ ;
 
        ok( 1, 'plain event triggered' ) ;
+       Stem::Event::stop_loop() ;
 }
 
 sub test_signal_events {
@@ -76,6 +76,22 @@ sub test_signal_events {
                        return ;
                }
 
+               my $event2 = Stem::Event::Timer->new(
+                       'object'        => $self,
+                       'method'        => 'send_int_signal',
+                       'delay'         => 3,
+               ) ;
+
+               ok( ref $event2, 'signal delay timer created' ) ;
+
+               Stem::Event::start_loop() ;
+
+               ok( 1, 'signal - event loop exit' ) ;
+       }
+}
+
+sub send_int_signal {
+
                my $event = Stem::Event::Signal->new(
                        'object'        => $self,
                        'signal'        => 'INT',
@@ -85,14 +101,10 @@ sub test_signal_events {
 
                $self->{'sig_event'} = $event ;
 
-               kill 'INT', $$ ;
-
-#print "kill INT\n" ;
 
-               Stem::Event::start_loop() ;
+print "kill INT\n" ;
 
-               ok( 1, 'signal - event loop exit' ) ;
-       }
+       kill 'INT', $$ ;
 }
 
 # callback method for signal
@@ -142,6 +154,8 @@ sub hard_timeout {
 
        my( $self ) = @_ ;
 
+send_int_signal() ;
+
        ok( 1, 'hard timer event triggered' ) ;
 
        if ( --$self->{'hard_timer_count'} > 0 ) {