From: Simon Ruderich Date: Mon, 27 Jun 2016 21:09:37 +0000 (+0200) Subject: Move Screen::die to the end of the class X-Git-Url: https://ruderich.org/simon/gitweb/?a=commitdiff_plain;h=59ecf9b92140258c9ec311f35aa5ea2440b68c1b;p=fcscs%2Ffcscs.git 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::". --- 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; }