This commit is contained in:
Elijah Perrault committed 2011-02-01 20:02:42 -07:00
1 parent 1da4798567
commit 0adcdf4b8f
1 file changed
+8 -5
+8 -5
View File
@@ -60,13 +60,14 @@ sub calc
if ($response->is_success) { if ($response->is_success) {
# If successful, decode the content. # If successful, decode the content.
my $d = $json->allow_nonref->utf8->relaxed->escape_slash->loose->allow_singlequote->allow_barekey->decode($response->decoded_content); my $d = $json->allow_nonref->utf8->relaxed->escape_slash->loose->allow_singlequote->allow_barekey->decode($response->decoded_content);
# And send to channel
if ($d->{error} eq "" or $d->{error} == 0) { if ($d->{error} eq "" or $d->{error} == 0) {
# And send to channel
privmsg($data{svr}, $data{chan}, "Result: ".$d->{lhs}." = ".$d->{rhs}); privmsg($data{svr}, $data{chan}, "Result: ".$d->{lhs}." = ".$d->{rhs});
} }
else { else {
# Otherwise, send an error message. # Otherwise, send an error message.
privmsg($data{svr}, $data{chan}, "Google calculator sent an error."); privmsg($data{svr}, $data{chan}, "Google Calculator sent an error.");
} }
} }
else { else {
@@ -88,8 +89,8 @@ __END__
=over =over
This module adds the CALC command for evaluating an This module adds the CALC command for evaluating an expression using
expression using Google Calculator. Google Calculator.
=back =back
@@ -122,7 +123,9 @@ Add Calc to the module autoload.
=over =over
This module requires LWP::UserAgent, URI::Escape and JSON both obtainable from CPAN (http://cpan.org) This module requires LWP::UserAgent, URI::Escape and JSON. All are obtainable
from the CPAN <http://www.cpan.org>.
This module is compatible with Auto version 3.0a2+. This module is compatible with Auto version 3.0a2+.
=back =back