/[cvs]/joko/TestArea/perl/runtime/POE/misc/snippets.txt
ViewVC logotype

Contents of /joko/TestArea/perl/runtime/POE/misc/snippets.txt

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations)
Sun May 11 21:48:53 2003 UTC (21 years, 6 months ago) by joko
Branch: MAIN
CVS Tags: HEAD
File MIME type: text/plain
initial commit

1 # ==============================================
2 my @removed_alarms = $kernel->alarm_remove_all( );
3 foreach my $alarm (@removed_alarms) {
4 print "-----\n";
5 print "Removed alarm event name: $alarm->[0]\n";
6 print "Removed alarm time : $alarm->[1]\n";
7 print "Removed alarm parameters: @{$alarm->[2]}\n";
8 }
9
10 # ==============================================
11 $_[KERNEL]->delay( time_is_up => 10 );
12
13
14 # ==============================================
15 # from "dbiagent.pl"
16 # alternate "got-row"-handler
17
18 sub got_message123 {
19
20 my $heap;
21
22 # we start the init process here
23 # set up data structures, etc
24
25 # and then start the query:
26 $heap->{helper}->query(
27 'read_hits_due' # the named query to execute
28 => '' => 'get_row_qa' # the session and state to send results to
29 # and any parameters would go here.
30 );
31 }
32
33
34 # ==============================================
35 # from "dbiagent.pl"
36 # attempt to recieve results in a different (new) session
37
38 #my ($self, $kernel, $heap) = @_[OBJECT, KERNEL, HEAP];
39
40 # session to recieve responses from database
41 #$heap->{reciever} = POE::Session->create(
42 #package_states => [ main => ['got_row'] ],
43 #inline_states =>
44 #{
45 #_start => sub { print "arg0=$_[ARG0], arg1=$_[ARG1], etc.=$_[ARG2]\n"; },
46 #_start => \&_start,
47 #got_row => sub { print "hello world!", "\n"; }
48 #_stop => \&stop_handler,
49 #},
50 #);
51
52
53
54 # ==============================================
55 # from POE::Component::Server:HTTPD
56 # try to shut the httpd down
57
58 sub shutdown
59 {
60 my($kernel, $session, $heap)=@_[KERNEL, SESSION, HEAP];
61
62 print "httpd shutting down", "\n";
63
64 #return;
65
66 #print "=========== idle: ", test_for_idle_poe_kernel(), ":::", "\n";
67
68 #print Data::Dumper::Dumper($session);
69
70 $kernel->signal($heap->{wheel}, 'INT');
71 $kernel->run_one_timeslice();
72 $kernel->signal($session, 'INT');
73 $kernel->run_one_timeslice();
74
75 $kernel->run_one_timeslice();
76 $kernel->run_one_timeslice();
77 $kernel->run_one_timeslice();
78 #print "ready.", "\n";
79 return;
80
81 # delete all wheels.
82 delete $heap->{wheel};
83
84 # clear your alias(es)
85 my @aliases = $kernel->alias_list();
86 foreach my $alias (@aliases) {
87 $kernel->alias_remove($alias);
88 }
89
90 # clear all alarms you might have set
91 foreach my $alarms (keys %{$heap->{alarms}}) {
92 $kernel->alarm_remove($alarms);
93 }
94 delete $heap->{alarms};
95
96
97 # get rid of external ref count
98 #$kernel->refcount_decrement($session, 'deamon');
99
100
101 # propagate the message to children
102 #$kernel->post($heap->{child_session}, 'shutdown');
103
104 #exit;
105 return;
106 }

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed