#!/usr/bin/env perl

use strict;
use warnings;

use Modern::Perl;
use Net::ClientServer;
use File::Basename;

my $platform = Net::ClientServer->new( 
#    home => File::Basename::basename( $0 ),
    port => 8012,
    server => {
        start => sub {
            print STDERR "Hello, World.\n";
        },
        run => sub {
            my $client = shift;
            $client->print( "Yoink $0!\n" );
            $client->close;
        },
        stop => sub {
            print STDERR "Bye, World.\n";
        },
    },
);

if ( $platform->started ) {
    say "Already started";
}
else {
    $platform->start;
}