Permalink
Browse files

ported wheel use from XyzState to XyzEvent

  • Loading branch information...
1 parent 74aca4c commit 81bfed146064cd85eaa1c4b85e10bb7b7d8c2874 @rcaputo committed May 7, 2001
View
@@ -27,7 +27,7 @@ sub login_login_start {
# switch the output filter to stream
$heap->{wheel}->set_output_filter( POE::Filter::Stream->new );
# switch the input event to login_input
- $heap->{wheel}->event( InputState => 'login_input' );
+ $heap->{wheel}->event( InputEvent => 'login_input' );
# display the prompt
$heap->{wheel}->put('login: ');
}
@@ -56,7 +56,7 @@ sub login_password_start {
# switch output filter to stream
$heap->{wheel}->set_output_filter( POE::Filter::Stream->new );
# switch input event to password_input
- $heap->{wheel}->event( InputState => 'password_input' );
+ $heap->{wheel}->event( InputEvent => 'password_input' );
# display the prompt
$heap->{wheel}->put('Password: ');
}
@@ -101,7 +101,7 @@ sub login_session_start {
( 'Handle' => $handle,
'Driver' => POE::Driver::SysRW->new,
'Filter' => POE::Filter::Line->new,
- 'ErrorState' => 'error',
+ 'ErrorEvent' => 'error',
);
# hello, world!\n
$heap->{wheel}->put('FreeBSD (localhost) (ttyp2)', '', '');
@@ -146,8 +146,8 @@ package main;
$heap->{wheel} = POE::Wheel::SocketFactory->new
( BindPort => $port,
- SuccessState => 'socket_ok',
- FailureState => 'socket_error',
+ SuccessEvent => 'socket_ok',
+ FailureEvent => 'socket_error',
Reuse => 'yes',
);
},
View
@@ -41,8 +41,8 @@ sub c_start
$heap->{wheel} = POE::Wheel::SocketFactory->new
( RemotePort => $port,
RemoteAddress => '127.0.0.1',
- SuccessState => 'connected', # generating this event on connection
- FailureState => 'error' # generating this event on error
+ SuccessEvent => 'connected', # generating this event on connection
+ FailureEvent => 'error' # generating this event on error
);
}
@@ -82,10 +82,10 @@ sub _start
$heap->{wheel_client} = POE::Wheel::ReadWrite->new
( Handle => $handle, # on this handle
Driver => POE::Driver::SysRW->new(), # using sysread and syswrite
- InputState => 'received',
+ InputEvent => 'received',
Filter => POE::Filter::Stream->new(),
- ErrorState => 'error', # generate this event on error
+ ErrorEvent => 'error', # generate this event on error
);
@@ -234,8 +234,8 @@ sub e_start
( BindPort => $port,
BindAddress => '127.0.0.1',
Reuse => 1,
- SuccessState => 'accept', # generating this event on connection
- FailureState => 'error' # generating this event on error
+ SuccessEvent => 'accept', # generating this event on connection
+ FailureEvent => 'error' # generating this event on error
);
}
@@ -277,9 +277,9 @@ sub _start
$heap->{wheel_client} = POE::Wheel::ReadWrite->new
( Handle => $handle, # on this handle
Driver => POE::Driver::SysRW->new(), # using sysread and syswrite
- ErrorState => 'error', # generate this event on error
+ ErrorEvent => 'error', # generate this event on error
- InputState => $heap->{filters}->{Stream}->[0],
+ InputEvent => $heap->{filters}->{Stream}->[0],
Filter => $heap->{filters}->{Stream}->[1],
);
_response($heap, "OK"); # start the dialog
@@ -318,7 +318,7 @@ sub _received
if($f)
{
print "Effect [$$] Switching to $type\n";
- $heap->{wheel_client}->event(InputState=>$f->[0]);
+ $heap->{wheel_client}->event(InputEvent=>$f->[0]);
$heap->{wheel_client}->set_filter($f->[1]);
$heap->{'ref'}=$f->[2];
} else
@@ -348,7 +348,7 @@ sub _received
################################################
-# InputState when we are using Filter::Stream
+# InputEvent when we are using Filter::Stream
sub r_stream
{
my($heap, $data)=@_[HEAP, ARG0];
@@ -357,15 +357,15 @@ sub r_stream
################################################
-# InputState when we are using Filter::Line
+# InputEvent when we are using Filter::Line
sub r_line
{
my($heap, $line)=@_[HEAP, ARG0];
_received($heap, 'Line', $line);
}
################################################
-# InputState when we are using Filter::Referenece
+# InputEvent when we are using Filter::Referenece
sub r_reference
{
my($heap, $reference)=@_[HEAP, ARG0];
View
@@ -45,7 +45,7 @@
( Handle => $handle, # using this handle
Driver => POE::Driver::SysRW->new, # using syswrite
Filter => POE::Filter::Line->new, # write lines
- ErrorState => 'log_error' # acknowledge errors
+ ErrorEvent => 'log_error' # acknowledge errors
);
$kernel->post($session, 'activity');
@@ -92,8 +92,8 @@
( 'Handle' => $handle, # follow this handle
'Driver' => POE::Driver::SysRW->new, # use sysread to read
'Filter' => POE::Filter::Line->new, # file contains lines
- 'InputState' => 'got a line', # input handler
- 'ErrorState' => 'error reading', # error handler
+ 'InputEvent' => 'got a line', # input handler
+ 'ErrorEvent' => 'error reading', # error handler
'PollInterval' => 2,
);
}
View
@@ -62,9 +62,9 @@ sub _start {
( Handle => $handle, # on this handle
Driver => POE::Driver::SysRW->new, # using sysread and syswrite
Filter => POE::Filter::HTTPD->new, # parsing I/O as http requests
- InputState => 'receive', # generating this event for requests
- ErrorState => 'error', # generating this event for errors
- FlushedState => 'flushed', # generating this event for all-sent
+ InputEvent => 'receive', # generating this event for requests
+ ErrorEvent => 'error', # generating this event for errors
+ FlushedEvent => 'flushed', # generating this event for all-sent
);
# save some information for the logs
$heap->{host} = $peer_addr;
@@ -168,8 +168,8 @@ sub _start {
$heap->{wheel} = POE::Wheel::SocketFactory->new
( BindPort => $port, # on this port
Reuse => 'yes', # and allow immediate port reuse
- SuccessState => 'accept_client', # generating this event on connection
- FailureState => 'accept_error' # generating this event on error
+ SuccessEvent => 'accept_client', # generating this event on connection
+ FailureEvent => 'accept_error' # generating this event on error
);
DEBUG && print "Listening to port $port on all interfaces.\n";
@@ -50,9 +50,9 @@ sub _start {
( Handle => $socket, # on this socket
Driver => POE::Driver::SysRW->new, # using sysread and syswrite
Filter => POE::Filter::Line->new, # parsing I/O as lines
- InputState => 'command', # generating this event on input
- ErrorState => 'error', # generating this event on error
- FlushedState => 'flushed' # generating this event on flush
+ InputEvent => 'command', # generating this event on input
+ ErrorEvent => 'error', # generating this event on error
+ FlushedEvent => 'flushed' # generating this event on flush
);
DEBUG &&
@@ -142,8 +142,8 @@ sub _start {
# create a socket factory
$heap->{wheel} = POE::Wheel::SocketFactory->new
( BindPort => 8888, # bind on this port
- SuccessState => 'connection', # generate this event for connections
- FailureState => 'error' # generate this event for errors
+ SuccessEvent => 'connection', # generate this event for connections
+ FailureEvent => 'error' # generate this event for errors
);
# watch for signals
$kernel->sig('CHLD', 'signal');
View
@@ -85,15 +85,15 @@ sub session_start {
( Handle => $socket,
Driver => POE::Driver::SysRW->new,
Filter => POE::Filter::Stream->new,
- InputState => 'client_input',
- ErrorState => 'client_error',
+ InputEvent => 'client_input',
+ ErrorEvent => 'client_error',
);
$heap->{wheel_server} = POE::Wheel::SocketFactory->new
( RemoteAddress => $remote_addr,
RemotePort => $remote_port,
- SuccessState => 'server_connect',
- FailureState => 'server_error',
+ SuccessEvent => 'server_connect',
+ FailureEvent => 'server_error',
);
}
@@ -172,8 +172,8 @@ sub session_server_connect {
( Handle => $socket,
Driver => POE::Driver::SysRW->new,
Filter => POE::Filter::Stream->new,
- InputState => 'server_input',
- ErrorState => 'server_error',
+ InputEvent => 'server_input',
+ ErrorEvent => 'server_error',
);
$heap->{state} = 'connected';
@@ -249,8 +249,8 @@ sub server_start {
( BindAddress => $local_addr, # bind to this address
BindPort => $local_port, # and bind to this port
Reuse => 'yes', # reuse immediately
- SuccessState => 'accept_success', # generate this event on connection
- FailureState => 'accept_failure', # generate this event on error
+ SuccessEvent => 'accept_success', # generate this event on connection
+ FailureEvent => 'accept_failure', # generate this event on error
);
}
View
@@ -39,8 +39,8 @@ sub c_start
$heap->{wheel} = POE::Wheel::SocketFactory->new
( RemotePort => $port,
RemoteAddress => '127.0.0.1',
- SuccessState => 'connected', # generating this event on connection
- FailureState => 'error' # generating this event on error
+ SuccessEvent => 'connected', # generating this event on connection
+ FailureEvent => 'error' # generating this event on error
);
$heap->{freezer}=$freezer;
}
@@ -76,10 +76,10 @@ sub _start
$heap->{wheel_client} = POE::Wheel::ReadWrite->new
( Handle => $handle, # on this handle
Driver => POE::Driver::SysRW->new(), # using sysread and syswrite
- InputState => 'received',
+ InputEvent => 'received',
Filter => POE::Filter::Reference->new($freezer),
- ErrorState => 'error', # generate this event on error
+ ErrorEvent => 'error', # generate this event on error
);
my $t=\ "Using $freezer";
@@ -154,8 +154,8 @@ sub e_start
( BindPort => $port,
BindAddress => '127.0.0.1',
Reuse => 1,
- SuccessState => 'accept', # generating this event on connection
- FailureState => 'error' # generating this event on error
+ SuccessEvent => 'accept', # generating this event on connection
+ FailureEvent => 'error' # generating this event on error
);
$heap->{freezer}=$freezer;
}
@@ -189,16 +189,16 @@ sub _start
$heap->{wheel_client} = POE::Wheel::ReadWrite->new
( Handle => $handle, # on this handle
Driver => POE::Driver::SysRW->new(), # using sysread and syswrite
- ErrorState => 'error', # generate this event on error
+ ErrorEvent => 'error', # generate this event on error
- InputState => 'received',
+ InputEvent => 'received',
Filter => POE::Filter::Reference->new($freezer),
);
$heap->{resp}=\ "Using $freezer";
}
################################################
-# InputState when we are using Filter::Referenece
+# InputEvent when we are using Filter::Referenece
sub received
{
my($heap, $reference)=@_[HEAP, ARG0];
View
@@ -49,8 +49,8 @@ sub client_start {
$heap->{'wheel'} = POE::Wheel::SocketFactory->new
( RemoteAddress => '127.0.0.1', # connect to this address
RemotePort => 31338, # connect to this port (eleet++)
- SuccessState => 'connected', # generating this event on success
- FailureState => 'error' # generating this event on failure
+ SuccessEvent => 'connected', # generating this event on success
+ FailureEvent => 'error' # generating this event on failure
);
}
@@ -79,9 +79,9 @@ sub client_connected {
( Handle => $socket, # read/write on this handle
Driver => POE::Driver::SysRW->new, # using sysread and syswrite
Filter => POE::Filter::Reference->new, # parsing refs
- InputState => 'received', # generating this on input
- ErrorState => 'error', # generating this on error
- FlushedState => 'flushed', # generating this on flush
+ InputEvent => 'received', # generating this on input
+ ErrorEvent => 'error', # generating this on error
+ FlushedEvent => 'flushed', # generating this on flush
);
# Send objects. If there are command-line arguments, the first one
View
@@ -97,8 +97,8 @@ sub daemon_start {
( Handle => $handle, # on this handle
Driver => POE::Driver::SysRW->new, # using sysread and syswrite
Filter => POE::Filter::Reference->new, # parsing as refs
- InputState => 'client', # generate this event on input
- ErrorState => 'error', # generate this event on error
+ InputEvent => 'client', # generate this event on input
+ ErrorEvent => 'error', # generate this event on error
);
}
@@ -168,8 +168,8 @@ sub server_start {
$heap->{wheel} = POE::Wheel::SocketFactory->new
( BindPort => 31338, # on the eleet++ port
Reuse => 'yes', # and allow immediate reuse of the port
- SuccessState => 'accept', # generating this event on connection
- FailureState => 'error' # generating this event on error
+ SuccessEvent => 'accept', # generating this event on connection
+ FailureEvent => 'error' # generating this event on error
);
}
Oops, something went wrong.

0 comments on commit 81bfed1

Please sign in to comment.