use feature ':5.10';
use POE::Session;
+use NDIRC::Dispatcher;
# We registered for all events, this will produce some debug info.
sub _default {
return;
}
+sub sig_usr2 {
+ my $heap = $_[HEAP];
+
+ open COMMANDS, 'commands';
+ my @commands = split /\W+/, do { local $/; <COMMANDS> };
+ close COMMANDS;
+
+ my $disp = new NDIRC::Dispatcher;
+ $disp->load(@commands);
+
+ open CHANNELS, 'channels';
+ while (<CHANNELS>){
+ print;
+ my ($chan, @types) = split /\s+/;
+ say "$chan - @types";
+ $disp->add_channel($chan,\@types);
+ }
+ close CHANNELS;
+
+ $heap->{disp} = $disp;
+}
+
sub sig_DIE {
my( $kernel,$sig, $ex ) = @_[ KERNEL,ARG0, ARG1 ];
say "DIED!!!!!!!!!!!!!!";