From 59ecf9b92140258c9ec311f35aa5ea2440b68c1b Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Mon, 27 Jun 2016 23:09:37 +0200 Subject: [PATCH] Move Screen::die to the end of the class This way we can just call "die" (meaning perl's die) without having to prefix it with "CORE::". No other changes besides removing "CORE::". --- bin/fcscs | 65 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 33 insertions(+), 32 deletions(-) diff --git a/bin/fcscs b/bin/fcscs index 97c4294..f775220 100755 --- a/bin/fcscs +++ b/bin/fcscs @@ -323,6 +323,39 @@ package Screen { return; } + + sub prompt { + my ($self, %settings) = @_; + + foreach (keys %settings) { + die if not exists $self->{prompt}{$_}; + $self->{prompt}{$_} = $settings{$_}; + } + return; + } + + + sub debug { + my ($self, $module, @args) = @_; + + return if not $self->{debug}; + + state $fh; # only open the file once per run + if (not defined $fh) { + # Ignore errors if the directory doesn't exist. + if (not open $fh, '>', "$ENV{HOME}/.config/fcscs/log") { + $fh = undef; # a failed open still writes a value to $fh + return; + } + $fh->autoflush(1); + } + + foreach (@args) { + $_ = $self->encode($_); + } + say $fh "$module: @args" or die $!; + return; + } sub die { my ($self, @args) = @_; @@ -355,38 +388,6 @@ package Screen { $self->deinit; exit 1; } - sub debug { - my ($self, $module, @args) = @_; - - return if not $self->{debug}; - - state $fh; # only open the file once per run - if (not defined $fh) { - # Ignore errors if the directory doesn't exist. - if (not open $fh, '>', "$ENV{HOME}/.config/fcscs/log") { - $fh = undef; # a failed open still writes a value to $fh - return; - } - $fh->autoflush(1); - } - - foreach (@args) { - $_ = $self->encode($_); - } - say $fh "$module: @args" or CORE::die $!; - return; - } - - - sub prompt { - my ($self, %settings) = @_; - - foreach (keys %settings) { - CORE::die if not exists $self->{prompt}{$_}; - $self->{prompt}{$_} = $settings{$_}; - } - return; - } # Wrapper for Curses. sub width { return $Curses::COLS; } -- 2.43.2