r41329 - in /branches/upstream/libmath-calc-units-perl/current: Changes META.yml Units.pm script/ucalc

jawnsy-guest at users.alioth.debian.org jawnsy-guest at users.alioth.debian.org
Wed Aug 5 01:43:09 UTC 2009


Author: jawnsy-guest
Date: Wed Aug  5 01:43:03 2009
New Revision: 41329

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=41329
Log:
[svn-upgrade] Integrating new upstream version, libmath-calc-units-perl (1.07)

Modified:
    branches/upstream/libmath-calc-units-perl/current/Changes
    branches/upstream/libmath-calc-units-perl/current/META.yml
    branches/upstream/libmath-calc-units-perl/current/Units.pm
    branches/upstream/libmath-calc-units-perl/current/script/ucalc

Modified: branches/upstream/libmath-calc-units-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmath-calc-units-perl/current/Changes?rev=41329&op=diff
==============================================================================
--- branches/upstream/libmath-calc-units-perl/current/Changes (original)
+++ branches/upstream/libmath-calc-units-perl/current/Changes Wed Aug  5 01:43:03 2009
@@ -1,7 +1,28 @@
 Revision history for Perl extension Math::Calc::Units.
 
-1.00  Fri Aug 10 12:36:10 2001
-	- original version; created by h2xs 1.19
+1.07  Tue Aug  4 2009
+	- Add a warning when -c used incorrectly
+
+1.06  Tue Oct 25 17:29:00 2005
+	- silly release to bump up kwalitee score
+
+1.05  Tue Oct 25 17:29:00 2005
+	- implemented distances
+	- cleaned up a few uses of uninitialized stuff
+
+1.04
+	- Implemented -a flag (aka abbreviate=>1 option) to spit out
+	  abbreviated units
+
+1.03
+	- Fixed 0.89 gigabytes getting described as gigabits
+
+1.02  Mon Oct 22 20:01:27 2001
+	- added timestamps
+        - added dates
+        - added constructor syntax for timestamps & dates
+        - fixed endless recursion bug
+        - added years (ugh... inexact unit)
 
 1.01  Fri Sep  4
 	- added unit breakdowns (2 hour 46 minute)
@@ -10,22 +31,5 @@
 	- added major unit preference ordering
 	- added out-of-range preference estimation
 
-1.02  Mon Oct 22 20:01:27 2001
-        - added timestamps
-        - added dates
-        - added constructor syntax for timestamps & dates
-        - fixed endless recursion bug
-        - added years (ugh... inexact unit)
-
-1.03
-        - Fixed 0.89 gigabytes getting described as gigabits
-
-1.04
-        - Implemented -a flag (aka abbreviate=>1 option) to spit out abbreviated units
-
-1.05  Tue Oct 25 17:29:00 2005
-        - implemented distances
-        - cleaned up a few uses of uninitialized stuff
-
-1.06  Tue Oct 25 17:29:00 2005
-        - silly release to bump up kwalitee score
+1.00  Fri Aug 10 12:36:10 2001
+	- original version; created by h2xs 1.19

Modified: branches/upstream/libmath-calc-units-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmath-calc-units-perl/current/META.yml?rev=41329&op=diff
==============================================================================
--- branches/upstream/libmath-calc-units-perl/current/META.yml (original)
+++ branches/upstream/libmath-calc-units-perl/current/META.yml Wed Aug  5 01:43:03 2009
@@ -1,13 +1,20 @@
-# http://module-build.sourceforge.net/META-spec.html
-#XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
-name:         Math-Calc-Units
-version:      1.06
-version_from: Units.pm
-installdirs:  site
-requires:
-
-distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.17
-license:      perl
-recommends:
-  Time::Local: 0
+--- #YAML:1.0
+name:               Math-Calc-Units
+version:            1.07
+abstract:           ~
+author:  []
+license:            unknown
+distribution_type:  module
+configure_requires:
+    ExtUtils::MakeMaker:  0
+build_requires:
+    ExtUtils::MakeMaker:  0
+requires:  {}
+no_index:
+    directory:
+        - t
+        - inc
+generated_by:       ExtUtils::MakeMaker version 6.50
+meta-spec:
+    url:      http://module-build.sourceforge.net/META-spec-v1.4.html
+    version:  1.4

Modified: branches/upstream/libmath-calc-units-perl/current/Units.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmath-calc-units-perl/current/Units.pm?rev=41329&op=diff
==============================================================================
--- branches/upstream/libmath-calc-units-perl/current/Units.pm (original)
+++ branches/upstream/libmath-calc-units-perl/current/Units.pm Wed Aug  5 01:43:03 2009
@@ -7,7 +7,7 @@
 use base 'Exporter';
 use vars qw($VERSION @EXPORT_OK);
 BEGIN {
-    $VERSION = '1.06';
+    $VERSION = '1.07';
     @EXPORT_OK = qw(calc readable convert equal exact);
 }
 use strict;
@@ -33,7 +33,7 @@
     return map { render($_, \%options) } choose_juicy_ones($v, \%options);
 }
 
-# convert : string x string -> string
+# convert : string x string [ x boolean ] -> string
 sub convert ($$;$) {
     my ($expr, $units, $exact) = @_;
     my $v = compute($expr);

Modified: branches/upstream/libmath-calc-units-perl/current/script/ucalc
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmath-calc-units-perl/current/script/ucalc?rev=41329&op=diff
==============================================================================
--- branches/upstream/libmath-calc-units-perl/current/script/ucalc (original)
+++ branches/upstream/libmath-calc-units-perl/current/script/ucalc Wed Aug  5 01:43:03 2009
@@ -1,43 +1,48 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
 use Getopt::Long;
+use File::Basename qw(basename);
 use Math::Calc::Units qw(convert readable calc);
+
+use strict;
+use warnings;
 
 sub usage {
     my ($msg, $bad) = @_;
     my $out = $bad ? *STDERR : *STDOUT;
 
+    my $CMD = basename($0);
     if ($msg) {
-	print $out "$0: $msg\n";
+	print $out "$CMD: $msg\n";
     }
 
     print $out <<"END";
 usage:
 
 Calculate the given expression, and guess human-readable units for the result:
-    $0 [-v] [-a] <expr>
+    $CMD [-v] [-a] <expr>
 
 Convert the given expression to the requested units:
-    $0 -c <expr> <unit>
-    $0 --convert <expr> <unit>
+    $CMD -c <expr> <unit>
+    $CMD --convert <expr> <unit>
 
 Examples:
 How long does it take to download 10MB over a 384 kilobit/sec connection?
-    $0 "10MB / 384Kbps"
+    $CMD "10MB / 384Kbps"
 
 What is the expected I/O rate for 8KB reads on a disk that reads at 20MB/sec
 and has an average seek time of 15ms?
-    $0 "8KB / (8KB/(20MB/sec) + 15ms)"
+    $CMD "8KB / (8KB/(20MB/sec) + 15ms)"
 
 Or if you prefer to calculate that by figuring out the number of seconds
 per byte and inverting:
-    $0 "((1sec/20MB) + 15ms/8KB) ** -1"
+    $CMD "((1sec/20MB) + 15ms/8KB) ** -1"
 
 How many gigabytes can you transfer in a week at 2MB/sec?
-    $0 -c "2MB/sec" "GB/week"
+    $CMD -c "2MB/sec" "GB/week"
 
 How many angels fit on the heads of 17 pins (with some assumptions)?
 (This demonstrates that unknown units are allowed, with plurals.)
-    $0 "42 angels/pinhead * 17 pinheads"
+    $CMD "42 angels/pinhead * 17 pinheads"
 END
 
     exit($bad ? 1 : 0);
@@ -57,7 +62,11 @@
 if ($action eq 'convert') {
     usage("not enough args", 1) if (@ARGV < 2);
     usage("too many args", 1) if (@ARGV > 2);
-    print convert($ARGV[0], $ARGV[1]), "\n";
+    my ($expr, $units) = @ARGV;
+    if ($units =~ /^\s*\d+/) {
+      warn("WARNING: Destination units in conversion should probably not have a value\n");
+    }
+    print convert($expr, $units), "\n";
 } elsif ($action eq 'readable') {
     usage("", 0) if @ARGV == 0;
     usage("too many ARGV", 1) if (@ARGV > 1);




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