r4730 - in /packages/libwww-google-calculator-perl/branches/upstream/current: Build.PL Changes MANIFEST META.yml Makefile.PL lib/WWW/Google/Calculator.pm t/02_live.t

gwolf at users.alioth.debian.org gwolf at users.alioth.debian.org
Fri Jan 19 16:43:27 CET 2007


Author: gwolf
Date: Fri Jan 19 16:43:27 2007
New Revision: 4730

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=4730
Log:
[svn-upgrade] Integrating new upstream version, libwww-google-calculator-perl (0.04)

Added:
    packages/libwww-google-calculator-perl/branches/upstream/current/t/02_live.t
Removed:
    packages/libwww-google-calculator-perl/branches/upstream/current/Build.PL
Modified:
    packages/libwww-google-calculator-perl/branches/upstream/current/Changes
    packages/libwww-google-calculator-perl/branches/upstream/current/MANIFEST
    packages/libwww-google-calculator-perl/branches/upstream/current/META.yml
    packages/libwww-google-calculator-perl/branches/upstream/current/Makefile.PL
    packages/libwww-google-calculator-perl/branches/upstream/current/lib/WWW/Google/Calculator.pm

Modified: packages/libwww-google-calculator-perl/branches/upstream/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libwww-google-calculator-perl/branches/upstream/current/Changes?rev=4730&op=diff
==============================================================================
--- packages/libwww-google-calculator-perl/branches/upstream/current/Changes (original)
+++ packages/libwww-google-calculator-perl/branches/upstream/current/Changes Fri Jan 19 16:43:27 2007
@@ -1,4 +1,10 @@
 Revision history for Perl module WWW::Google::Calculator
+
+0.04 2006-12-04T14:04:56+09:00
+     - Added live test with real network
+     - Fixed module break answer when it has multiplier (Reported by Torkild Retvedt)
+     - Fixed none ascii operator (×) to *
+     - Changed module builder Module::Build to Module::Install
 
 0.03 2006-06-10T17:38:23+09:00
      - Fixed typo s/Class::Accessors::Fast/Class::Accessor::Fast/ in Build.PL

Modified: packages/libwww-google-calculator-perl/branches/upstream/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libwww-google-calculator-perl/branches/upstream/current/MANIFEST?rev=4730&op=diff
==============================================================================
--- packages/libwww-google-calculator-perl/branches/upstream/current/MANIFEST (original)
+++ packages/libwww-google-calculator-perl/branches/upstream/current/MANIFEST Fri Jan 19 16:43:27 2007
@@ -1,12 +1,12 @@
-MANIFEST
+Changes
+lib/WWW/Google/Calculator.pm
+LICENSE
+Makefile.PL
+MANIFEST			This list of files
+META.yml
 README
-LICENSE
-Todo
-Changes
+t/01_load.t
+t/02_live.t
 t/pod-coverage.t
 t/pod.t
-Build.PL
-Makefile.PL
-lib/WWW/Google/Calculator.pm
-t/01_load.t
-META.yml
+Todo

Modified: packages/libwww-google-calculator-perl/branches/upstream/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libwww-google-calculator-perl/branches/upstream/current/META.yml?rev=4730&op=diff
==============================================================================
--- packages/libwww-google-calculator-perl/branches/upstream/current/META.yml (original)
+++ packages/libwww-google-calculator-perl/branches/upstream/current/META.yml Fri Jan 19 16:43:27 2007
@@ -1,22 +1,17 @@
----
+abstract: Perl interface for Google calculator
+author: Daisuke Murase <typester at cpan.org>
+build_requires: 
+  Test::More: 0
+distribution_type: module
+generated_by: Module::Install version 0.64
+license: perl
 name: WWW-Google-Calculator
-version: 0.03
-author:
-  - 'Daisuke Murase <typester at cpan.org>'
-abstract: Perl interface for Google calculator
-license: perl
-resources:
-  license: http://dev.perl.org/licenses/
-requires:
+no_index: 
+  directory: 
+    - inc
+    - t
+requires: 
   Class::Accessor::Fast: 0
   HTML::TokeParser: 0
-  URI: 0
   WWW::Mechanize: 0
-provides:
-  WWW::Google::Calculator:
-    file: lib/WWW/Google/Calculator.pm
-    version: 0.03
-generated_by: Module::Build version 0.2801
-meta-spec:
-  url: http://module-build.sourceforge.net/META-spec-v1.2.html
-  version: 1.2
+version: 0.04

Modified: packages/libwww-google-calculator-perl/branches/upstream/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libwww-google-calculator-perl/branches/upstream/current/Makefile.PL?rev=4730&op=diff
==============================================================================
--- packages/libwww-google-calculator-perl/branches/upstream/current/Makefile.PL (original)
+++ packages/libwww-google-calculator-perl/branches/upstream/current/Makefile.PL Fri Jan 19 16:43:27 2007
@@ -1,27 +1,14 @@
-unless (eval "use Module::Build::Compat 0.02; 1" ) {
-  print "This module requires Module::Build to install itself.\n";
+use inc::Module::Install;
+name 'WWW-Google-Calculator';
+all_from 'lib/WWW/Google/Calculator.pm';
 
-  require ExtUtils::MakeMaker;
-  my $yn = ExtUtils::MakeMaker::prompt
-    ('  Install Module::Build from CPAN?', 'y');
+requires 'Class::Accessor::Fast' => 0;
+requires 'HTML::TokeParser' => 0;
+requires 'WWW::Mechanize' => 0;
 
-  if ($yn =~ /^y/i) {
-    require Cwd;
-    require File::Spec;
-    require CPAN;
+build_requires 'Test::More';
 
-    # Save this 'cause CPAN will chdir all over the place.
-    my $cwd = Cwd::cwd();
-    my $makefile = File::Spec->rel2abs($0);
+use_test_base;
 
-    CPAN::Shell->install('Module::Build::Compat');
-
-    chdir $cwd or die "Cannot chdir() back to $cwd: $!";
-    exec $^X, $makefile, @ARGV;  # Redo now that we have Module::Build
-  } else {
-    warn " *** Cannot install without Module::Build.  Exiting ...\n";
-    exit 1;
-  }
-}
-Module::Build::Compat->run_build_pl(args => \@ARGV);
-Module::Build::Compat->write_makefile();
+auto_include;
+WriteAll;

Modified: packages/libwww-google-calculator-perl/branches/upstream/current/lib/WWW/Google/Calculator.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libwww-google-calculator-perl/branches/upstream/current/lib/WWW/Google/Calculator.pm?rev=4730&op=diff
==============================================================================
--- packages/libwww-google-calculator-perl/branches/upstream/current/lib/WWW/Google/Calculator.pm (original)
+++ packages/libwww-google-calculator-perl/branches/upstream/current/lib/WWW/Google/Calculator.pm Fri Jan 19 16:43:27 2007
@@ -7,7 +7,7 @@
 use HTML::TokeParser;
 use URI;
 
-our $VERSION = '0.03';
+our $VERSION = '0.04';
 
 __PACKAGE__->mk_accessors(qw/mech error/);
 
@@ -86,6 +86,9 @@
 sub parse_html {
     my ( $self, $html ) = @_;
 
+    $html =~ s!<sup>(.*?)</sup>!^$1!g;
+    $html =~ s!&#215;!*!g;
+
     my $res;
     my $p = HTML::TokeParser->new( \$html );
     while ( my $token = $p->get_token ) {

Added: packages/libwww-google-calculator-perl/branches/upstream/current/t/02_live.t
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libwww-google-calculator-perl/branches/upstream/current/t/02_live.t?rev=4730&op=file
==============================================================================
--- packages/libwww-google-calculator-perl/branches/upstream/current/t/02_live.t (added)
+++ packages/libwww-google-calculator-perl/branches/upstream/current/t/02_live.t Fri Jan 19 16:43:27 2007
@@ -1,0 +1,130 @@
+use Test::Base;
+
+plan skip_all => 'set TEST_LIVE to enable this test' unless $ENV{TEST_LIVE};
+plan tests => 1 * blocks;
+
+use WWW::Google::Calculator;
+
+sub calc {
+    my $calc = WWW::Google::Calculator->new;
+    $calc->calc(@_);
+}
+
+filters {
+    input => [qw/chomp calc/],
+    expected => [qw/chomp/],
+};
+
+run_compare input => 'expected';
+
+__END__
+
+# basic tests (listed as example at http://www.google.com/help/calculator.html)
+
+=== Addition
+--- input
+3+44
+--- expected
+3 + 44 = 47
+
+=== subtraction
+--- input
+13-5
+--- expected
+13 - 5 = 8
+
+=== multiplication
+--- input
+7*8
+--- expected
+7 * 8 = 56
+
+=== division
+--- input
+12/3
+--- expected
+12 / 3 = 4
+
+=== exponentiation (raise to a power of)
+--- input
+8^2
+--- expected
+8^2 = 64
+
+=== modulo (finds the remainder after division)
+--- input
+8%7
+--- expected
+8 modulo 7 = 1
+
+=== X choose Y determines the number of ways of choosing a set of Y elements from a set of X elements
+--- input
+18 choose 4
+--- expected
+18 choose 4 = 3 060
+
+=== calculates the nth root of a number
+--- input
+5th root of 32
+--- expected
+5th root of 32 = 2
+
+=== X % of Y computes X percent of Y
+--- input
+20% of 150
+--- expected
+20% of 150 = 30
+
+=== square root
+--- input
+sqrt(9)
+--- expected
+sqrt(9) = 3
+
+=== trigonometric functions (numbers are assumed to be radians)
+--- input
+sin(pi/3)
+--- expected
+sin(pi / 3) = 0.866025404
+
+=== trigonometric functions (numbers are assumed to be radians) 2
+--- input
+tan(45 degrees)
+--- expected
+tan(45 degrees) = 1
+
+=== logarithm base e
+--- input
+ln(17)
+--- expected
+ln(17) = 2.83321334
+
+=== ogarithm base 10
+--- input
+log(1,000)
+--- expected
+log(1 000) = 3
+
+=== factorial
+--- input
+5!
+--- expected
+5 ! = 120
+
+=== calc with units
+--- input
+1 a.u./c
+--- expected
+(1 Astronomical Unit) / the speed of light = 8.31675359 minutes
+
+=== units translation
+--- input
+300kbps in KB/s
+--- expected
+300 kbps = 37.5 kilobytes / second
+
+=== multiplier (reported by Torkild Retvedt)
+--- input
+10^20
+--- expected
+10^20 = 1.0 * 10^20




More information about the Pkg-perl-cvs-commits mailing list