diff options
author | Jason May <jason.a.may@gmail.com> | 2010-06-15 12:39:26 -0400 |
---|---|---|
committer | Jason May <jason.a.may@gmail.com> | 2010-06-15 12:45:16 -0400 |
commit | 184a83c2f7885c9a08e4123fd07a73bf5ae8cb59 (patch) | |
tree | 6be4e667eff4f3b2e8543943872fa429e6361bd2 | |
parent | 2769b74f997e89d89ba3d7088941a29c37aa0a8a (diff) | |
download | app-termcast-184a83c2f7885c9a08e4123fd07a73bf5ae8cb59.tar.gz app-termcast-184a83c2f7885c9a08e4123fd07a73bf5ae8cb59.zip |
refactor the estrablishment message into its own attribute
-rw-r--r-- | lib/App/Termcast.pm | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/App/Termcast.pm b/lib/App/Termcast.pm index 422c3be..4b51398 100644 --- a/lib/App/Termcast.pm +++ b/lib/App/Termcast.pm @@ -121,6 +121,18 @@ has _got_winch => ( init_arg => undef, ); +has establishment_message => ( + traits => ['NoGetopt'], + is => 'ro', + isa => 'Str', + lazy_build => 1, +); + +sub _build_establishment_message { + my $self = shift; + return sprintf("hello %s %s\n", $self->user, $self->password); +} + has socket => ( traits => ['NoGetopt'], is => 'rw', @@ -135,7 +147,7 @@ sub _build_socket { PeerPort => $self->port); die "Couldn't connect to " . $self->host . ": $!" unless $socket; - $socket->syswrite('hello '.$self->user.' '.$self->password."\n"); + $socket->syswrite($self->establishment_message); return $socket; } |