aboutsummaryrefslogtreecommitdiff
path: root/t/release/servers/01-basic.pl
diff options
context:
space:
mode:
Diffstat (limited to 't/release/servers/01-basic.pl')
-rw-r--r--t/release/servers/01-basic.pl67
1 files changed, 31 insertions, 36 deletions
diff --git a/t/release/servers/01-basic.pl b/t/release/servers/01-basic.pl
index fe5ea06..086e213 100644
--- a/t/release/servers/01-basic.pl
+++ b/t/release/servers/01-basic.pl
@@ -1,8 +1,13 @@
-# A fairly simple example:
use strict;
use warnings;
+use JSON::Meth;
+use 5.020;
use POE qw(Component::Server::IRC);
+$|++;
+
+my ($Port) = @ARGV;
+
my %config = (
servername => 'simple.poco.server.irc',
nicklen => 15,
@@ -24,44 +29,34 @@ sub _start {
my ($kernel, $heap) = @_[KERNEL, HEAP];
$heap->{ircd}->yield('register', 'all');
-
- # Anyone connecting from the loopback gets spoofed hostname
- # $heap->{ircd}->add_auth(
- # mask => '*@localhost',
- # spoof => 'm33p.com',
- # no_tilde => 1,
- # );
-
- # We have to add an auth as we have specified one above.
$heap->{ircd}->add_auth(mask => '*@*');
-
- # Start a listener on the 'standard' IRC port.
- $heap->{ircd}->add_listener(port => 5667);
-
- # Add an operator who can connect from localhost
- $heap->{ircd}->add_operator(
- {
- username => 'moo',
- password => 'fishdont',
- }
- );
+ $heap->{ircd}->add_listener(port => $Port);
+ $heap->{ircd}->add_operator({
+ username => 'moo',
+ password => 'fishdont',
+ });
}
sub _default {
my ($event, @args) = @_[ARG0 .. $#_];
-
- print "$event: ";
- for my $arg (@args) {
- if (ref($arg) eq 'ARRAY') {
- print "[", join ( ", ", @$arg ), "] ";
- }
- elsif (ref($arg) eq 'HASH') {
- print "{", join ( ", ", %$arg ), "} ";
- }
- else {
- print "'$arg' ";
- }
- }
-
- print "\n";
+ say {
+ event => $event,
+ args => \@args,
+ }->$j;
+
+
+ # print "$event: ";
+ # for my $arg (@args) {
+ # if (ref($arg) eq 'ARRAY') {
+ # print "[", join ( ", ", @$arg ), "] ";
+ # }
+ # elsif (ref($arg) eq 'HASH') {
+ # print "{", join ( ", ", %$arg ), "} ";
+ # }
+ # else {
+ # print "'$arg' ";
+ # }
+ # }
+ #
+ # print "\n";
}