From bbf4eddba9a75f46bf52a633e5c29e595a7c4368 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Sat, 11 Jul 2020 17:38:24 -0700 Subject: [PATCH] PBot: do not connect if env PBOT_LOCAL is true --- PBot/PBot.pm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/PBot/PBot.pm b/PBot/PBot.pm index 3e0c4e19..07d16502 100644 --- a/PBot/PBot.pm +++ b/PBot/PBot.pm @@ -278,6 +278,7 @@ sub random_nick { # TODO: add disconnect subroutine sub connect { my ($self, $server) = @_; + return if $ENV{PBOT_LOCAL}; if ($self->{connected}) { # TODO: disconnect, clean-up, etc @@ -333,15 +334,15 @@ sub connect { #main loop sub do_one_loop { my $self = shift; - $self->{irc}->do_one_loop(); - $self->{select_handler}->do_select(); + $self->{irc}->do_one_loop() if $self->{connected}; + $self->{select_handler}->do_select; } sub start { my $self = shift; while (1) { - $self->connect() if not $self->{connected}; - $self->do_one_loop() if $self->{connected}; + $self->connect if not $self->{connected}; + $self->do_one_loop; } }