Skip to content

Commit

Permalink
start and run work
Browse files Browse the repository at this point in the history
  • Loading branch information
exodist committed Nov 29, 2023
1 parent e5b9b76 commit 6ad82fc
Show file tree
Hide file tree
Showing 23 changed files with 1,393 additions and 2,835 deletions.
2 changes: 2 additions & 0 deletions dist.ini
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ goto::file = 0.005
File::Path = 2.11
List::Util = 1.44
IO::Handle = 1.27
Linux::Inotify2 = 2.3
YAML::Tiny = 0
Data::UUID = 0
File::Find = 0
Expand Down Expand Up @@ -111,6 +112,7 @@ Text::ParseWords = 0

[Prereqs / TestRequires]
File::Copy = 0
Child = 0

[Prereqs / DevelopRequires]
Test::Spelling = 0.12 ; for xt/author/pod-spell.t
Expand Down
51 changes: 51 additions & 0 deletions lib/App/Yath/Client.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package App::Yath::Client;
use strict;
use warnings;

use Carp qw/croak/;

use Test2::Harness::IPC::Protocol;

use parent 'Test2::Harness';
use Test2::Harness::Util::HashBase qw{
<settings
+ipc +connection
};

sub init {
my $self = shift;

my $settings = $self->{+SETTINGS} or croak "'settings' is a required attribute";
croak "'ipc' is not set, and there is no 'ipc' category in the settings"
unless $self->{+IPC} or $settings->ipc;

$self->ipc;

$self->SUPER::init();
}

sub ipc {
my $self = shift;

return $self->{+IPC} if $self->{+IPC};

my $settings = $self->{+SETTINGS};
croak "No 'ipc' category in settings" unless $settings->ipc;
my $ipc_s = App::Yath::Options::IPC->vivify_ipc($settings);

return $self->{+IPC} = Test2::Harness::IPC::Protocol->new(protocol => $ipc_s->{protocol}, peer_pid => $ipc_s->{peer_pid});
}

sub connect {
my $self = shift;

return $self->{+CONNECTION} if $self->{+CONNECTION};

my $settings = $self->{+SETTINGS};
croak "No 'ipc' category in settings" unless $settings->ipc;
my $ipc_s = App::Yath::Options::IPC->vivify_ipc($settings);

return $self->{+CONNECTION} = $self->ipc->connect($ipc_s->{address}, $ipc_s->{port}, peer_pid => $ipc_s->{peer_pid});
}

1;
Loading

0 comments on commit 6ad82fc

Please sign in to comment.