From 03929dac2a29664878d2c971648a4fe1fb698462 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 15 Apr 2024 22:19:02 +0200 Subject: Adding upstream version 20231031. Signed-off-by: Daniel Baumann --- scripts/calc.pl | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 scripts/calc.pl (limited to 'scripts/calc.pl') diff --git a/scripts/calc.pl b/scripts/calc.pl new file mode 100644 index 0000000..21aa7de --- /dev/null +++ b/scripts/calc.pl @@ -0,0 +1,30 @@ +use strict; +use vars qw($VERSION %IRSSI); + +use Irssi qw(command_bind active_win); +$VERSION = '1.10'; +%IRSSI = ( + authors => 'Juerd', + contact => 'juerd@juerd.nl', + name => 'Calculator', + description => 'Simple /calc mechanism', + license => 'Public Domain', + url => 'http://juerd.nl/irssi/', + changed => 'Thu Mar 19 11:00 CET 2002', +); + +command_bind( + calc => sub { + my ($msg) = @_; + for ($msg) { + s/,/./g; + s/[^*.+0-9&|)(x\/^-]//g; + s/\*\*/^/g; + s/([*+\\.\/x-])\1*/$1/g; + s/\^/**/g; + s/(?print($@ ? "$msg = ERROR (${\ (split / at/, $@, 2)[0]})" : "$msg = $answer"); + } +); -- cgit v1.2.3