Hello community,

here is the log from the commit of package perl-Statistics-Descriptive for 
openSUSE:Factory checked in at 2012-02-17 12:08:07
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Statistics-Descriptive (Old)
 and      /work/SRC/openSUSE:Factory/.perl-Statistics-Descriptive.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "perl-Statistics-Descriptive", Maintainer is ""

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/perl-Statistics-Descriptive/perl-Statistics-Descriptive.changes
  2011-12-22 10:54:39.000000000 +0100
+++ 
/work/SRC/openSUSE:Factory/.perl-Statistics-Descriptive.new/perl-Statistics-Descriptive.changes
     2012-02-17 12:08:10.000000000 +0100
@@ -1,0 +2,17 @@
+Fri Feb 17 08:41:58 UTC 2012 - [email protected]
+
+- updated to 3.0300
+   - Now mean() and median() and other routines return undef() if there are
+   no data.
+   - Somewhat incompatible change: some methods that returned undef() under
+   list context now return an empty list (so it will be false).
+       - it is generally not recommended to call such methods in list context
+       as they should always be called in scalar context.
+   - Resolves https://rt.cpan.org/Ticket/Display.html?id=74693
+       - thanks to Shawn Laffan for the report and the patch.
+
+   - Fix https://rt.cpan.org/Ticket/Display.html?id=72495 .
+       - percentile should not die and should return undef if there are
+       no elements in the collection.
+
+-------------------------------------------------------------------

Old:
----
  Statistics-Descriptive-3.0202.tar.gz

New:
----
  Statistics-Descriptive-3.0300.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ perl-Statistics-Descriptive.spec ++++++
--- /var/tmp/diff_new_pack.rRrVJe/_old  2012-02-17 12:08:11.000000000 +0100
+++ /var/tmp/diff_new_pack.rRrVJe/_new  2012-02-17 12:08:11.000000000 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package perl-Statistics-Descriptive
 #
-# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -16,38 +16,25 @@
 #
 
 
-%bcond_with pod
-
 Name:           perl-Statistics-Descriptive
+Version:        3.0300
+Release:        0
 %define cpan_name Statistics-Descriptive
-Summary:        Module of basic descriptive statistical functions
-License:        GPL-1.0+ or Artistic-1.0
+Summary:        Module of basic descriptive statistical functions.
+License:        Artistic-1.0 or GPL-1.0+
 Group:          Development/Libraries/Perl
-Version:        3.0202
-Release:        0
 Url:            http://search.cpan.org/dist/Statistics-Descriptive/
-Source:         
http://www.cpan.org/modules/by-module/Statistics/Statistics-Descriptive-%{version}.tar.gz
+Source:         
http://www.cpan.org/authors/id/S/SH/SHLOMIF/%{cpan_name}-%{version}.tar.gz
 BuildArch:      noarch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
-%{perl_requires}
 BuildRequires:  perl
 BuildRequires:  perl-macros
 BuildRequires:  perl(Module::Build)
-%if %{with pod}
-BuildRequires:  perl(Test::Pod) >= 1.22
-BuildRequires:  perl(Test::Pod::Coverage) >= 1.08
-%endif
-BuildRequires:  perl(Carp)
-BuildRequires:  perl(lib)
-BuildRequires:  perl(POSIX)
-BuildRequires:  perl(strict)
-BuildRequires:  perl(vars)
-BuildRequires:  perl(warnings)
-Requires:       perl(Carp)
-Requires:       perl(POSIX)
-Requires:       perl(strict)
-Requires:       perl(vars)
-Requires:       perl(warnings)
+#BuildRequires: perl(IO::All)
+#BuildRequires: perl(Statistics::Descriptive)
+#BuildRequires: perl(Test::Run::Builder)
+#BuildRequires: perl(Test::Run::CmdLine::Iface)
+%{perl_requires}
 
 %description
 This module provides basic functions used in descriptive statistics. It has
@@ -57,29 +44,31 @@
 the full method, the entire data set is retained and additional functions
 are available.
 
-Authors:
---------
-    Shlomi Fish <[email protected]>
+Whenever a division by zero may occur, the denominator is checked to be
+greater than the value '$Statistics::Descriptive::Tolerance', which
+defaults to 0.0. You may want to change this value to some small positive
+value such as 1e-24 in order to obtain error messages in case of very small
+denominators.
+
+Many of the methods (both Sparse and Full) cache values so that subsequent
+calls with the same arguments are faster.
 
 %prep
 %setup -q -n %{cpan_name}-%{version}
 
 %build
 %{__perl} Build.PL installdirs=vendor
-./Build
+./Build build flags=%{?_smp_mflags}
 
 %check
 ./Build test
 
 %install
-./Build install destdir=$RPM_BUILD_ROOT create_packlist=0
+./Build install destdir=%{buildroot} create_packlist=0
 %perl_gen_filelist
 
-%clean
-%{__rm} -rf $RPM_BUILD_ROOT
-
 %files -f %{name}.files
-%defattr(-,root,root,-)
-%doc Changes examples README rejects UserSurvey.txt
+%defattr(-,root,root,755)
+%doc Changes examples README rejects scripts UserSurvey.txt
 
 %changelog

++++++ Statistics-Descriptive-3.0202.tar.gz -> 
Statistics-Descriptive-3.0300.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Statistics-Descriptive-3.0202/Changes 
new/Statistics-Descriptive-3.0300/Changes
--- old/Statistics-Descriptive-3.0202/Changes   2011-07-23 15:11:05.000000000 
+0200
+++ new/Statistics-Descriptive-3.0300/Changes   2012-02-11 11:23:07.000000000 
+0100
@@ -1,5 +1,20 @@
 Revision history for Perl extension Statistics::Descriptive.
 
+3.0300      February 11, 2012
+    - Now mean() and median() and other routines return undef() if there are
+    no data.
+    - Somewhat incompatible change: some methods that returned undef() under
+    list context now return an empty list (so it will be false).
+        - it is generally not recommended to call such methods in list context
+        as they should always be called in scalar context.
+    - Resolves https://rt.cpan.org/Ticket/Display.html?id=74693
+        - thanks to Shawn Laffan for the report and the patch.
+
+3.0203      November 17, 2011
+    - Fix https://rt.cpan.org/Ticket/Display.html?id=72495 .
+        - percentile should not die and should return undef if there are
+        no elements in the collection.
+
 3.0202      July 23, 2011
     - Moved tag-release.pl to scripts/tag-release.pl (though we now use
     Mercurial instead of Subversion.)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Statistics-Descriptive-3.0202/MANIFEST 
new/Statistics-Descriptive-3.0300/MANIFEST
--- old/Statistics-Descriptive-3.0202/MANIFEST  2011-07-23 15:11:05.000000000 
+0200
+++ new/Statistics-Descriptive-3.0300/MANIFEST  2012-02-11 11:23:07.000000000 
+0100
@@ -17,3 +17,4 @@
 t/pod-coverage.t
 t/pod.t
 t/quantile.t
+META.json
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Statistics-Descriptive-3.0202/META.json 
new/Statistics-Descriptive-3.0300/META.json
--- old/Statistics-Descriptive-3.0202/META.json 1970-01-01 01:00:00.000000000 
+0100
+++ new/Statistics-Descriptive-3.0300/META.json 2012-02-11 11:23:07.000000000 
+0100
@@ -0,0 +1,74 @@
+{
+   "abstract" : "Module of basic descriptive statistical functions.",
+   "author" : [
+      "Shlomi Fish <[email protected]>"
+   ],
+   "dynamic_config" : 1,
+   "generated_by" : "Module::Build version 0.38, CPAN::Meta::Converter version 
2.113640",
+   "keywords" : [
+      "average",
+      "distribution",
+      "mean",
+      "median",
+      "statistics",
+      "stats",
+      "stddev",
+      "standard deviation"
+   ],
+   "license" : [
+      "perl_5"
+   ],
+   "meta-spec" : {
+      "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec";,
+      "version" : "2"
+   },
+   "name" : "Statistics-Descriptive",
+   "prereqs" : {
+      "build" : {
+         "requires" : {
+            "Benchmark" : 0,
+            "Test::More" : 0,
+            "lib" : 0
+         }
+      },
+      "configure" : {
+         "requires" : {
+            "Module::Build" : "0.36"
+         }
+      },
+      "runtime" : {
+         "requires" : {
+            "Carp" : 0,
+            "POSIX" : 0,
+            "strict" : 0,
+            "vars" : 0,
+            "warnings" : 0
+         }
+      }
+   },
+   "provides" : {
+      "Statistics::Descriptive" : {
+         "file" : "lib/Statistics/Descriptive.pm",
+         "version" : "3.0300"
+      },
+      "Statistics::Descriptive::Full" : {
+         "file" : "lib/Statistics/Descriptive.pm",
+         "version" : "3.0300"
+      },
+      "Statistics::Descriptive::Sparse" : {
+         "file" : "lib/Statistics/Descriptive.pm",
+         "version" : "3.0300"
+      }
+   },
+   "release_status" : "stable",
+   "resources" : {
+      "homepage" : 
"http://web-cpan.berlios.de/modules/Statistics-Descriptive/";,
+      "license" : [
+         "http://dev.perl.org/licenses/";
+      ],
+      "repository" : {
+         "url" : "https://bitbucket.org/shlomif/perl-statistics-descriptive";
+      }
+   },
+   "version" : "3.0300"
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Statistics-Descriptive-3.0202/META.yml 
new/Statistics-Descriptive-3.0300/META.yml
--- old/Statistics-Descriptive-3.0202/META.yml  2011-07-23 15:11:05.000000000 
+0200
+++ new/Statistics-Descriptive-3.0300/META.yml  2012-02-11 11:23:07.000000000 
+0100
@@ -8,7 +8,8 @@
   lib: 0
 configure_requires:
   Module::Build: 0.36
-generated_by: 'Module::Build version 0.3617'
+dynamic_config: 1
+generated_by: 'Module::Build version 0.38, CPAN::Meta::Converter version 
2.113640'
 keywords:
   - average
   - distribution
@@ -26,13 +27,13 @@
 provides:
   Statistics::Descriptive:
     file: lib/Statistics/Descriptive.pm
-    version: 3.0202
+    version: 3.0300
   Statistics::Descriptive::Full:
     file: lib/Statistics/Descriptive.pm
-    version: 3.0202
+    version: 3.0300
   Statistics::Descriptive::Sparse:
     file: lib/Statistics/Descriptive.pm
-    version: 3.0202
+    version: 3.0300
 requires:
   Carp: 0
   POSIX: 0
@@ -43,4 +44,4 @@
   homepage: http://web-cpan.berlios.de/modules/Statistics-Descriptive/
   license: http://dev.perl.org/licenses/
   repository: https://bitbucket.org/shlomif/perl-statistics-descriptive
-version: 3.0202
+version: 3.0300
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Statistics-Descriptive-3.0202/Makefile.PL 
new/Statistics-Descriptive-3.0300/Makefile.PL
--- old/Statistics-Descriptive-3.0202/Makefile.PL       2011-07-23 
15:11:05.000000000 +0200
+++ new/Statistics-Descriptive-3.0300/Makefile.PL       2012-02-11 
11:23:07.000000000 +0100
@@ -1,4 +1,4 @@
-# Note: this file was auto-generated by Module::Build::Compat version 0.36_17
+# Note: this file was auto-generated by Module::Build::Compat version 0.3800
 use ExtUtils::MakeMaker;
 WriteMakefile
 (
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/Statistics-Descriptive-3.0202/lib/Statistics/Descriptive.pm 
new/Statistics-Descriptive-3.0300/lib/Statistics/Descriptive.pm
--- old/Statistics-Descriptive-3.0202/lib/Statistics/Descriptive.pm     
2011-07-23 15:11:05.000000000 +0200
+++ new/Statistics-Descriptive-3.0300/lib/Statistics/Descriptive.pm     
2012-02-11 11:23:07.000000000 +0100
@@ -10,7 +10,7 @@
                  ##Perl5.  01-03 weren't bug free.
 use vars (qw($VERSION $Tolerance));
 
-$VERSION = '3.0202';
+$VERSION = '3.0300';
 
 $Tolerance = 0.0;
 
@@ -18,7 +18,7 @@
 
 use vars qw($VERSION);
 
-$VERSION = '3.0202';
+$VERSION = '3.0300';
 
 use vars qw(%fields);
 use Carp;
@@ -76,15 +76,15 @@
 ##Define the fields to be used as methods
 %fields = (
   count                        => 0,
-  mean                 => 0,
-  sum                  => 0,
-  sumsq                        => 0,
+  mean                 => undef,
+  sum                  => undef,
+  sumsq                        => undef,
   min                  => undef,
   max                  => undef,
   mindex               => undef,
   maxdex               => undef,
   sample_range         => undef,
-  variance => undef,
+  variance              => undef,
   );
 
 __PACKAGE__->_make_accessors( [ grep { $_ ne "variance" } keys(%fields) ] );
@@ -176,19 +176,22 @@
   $self->count($count);
   ##indicator the value is not cached.  Variance isn't commonly enough
   ##used to recompute every single data add.
-  $self->_variance(undef());
+  $self->_variance(undef);
   return 1;
 }
 
 sub standard_deviation {
   my $self = shift;  ##Myself
-  return undef if (!$self->count());
+  return if (!$self->count());
   return sqrt($self->variance());
 }
 
 ##Return variance; if needed, compute and cache it.
 sub variance {
   my $self = shift;  ##Myself
+
+  return if (!$self->count());
+  
   my $div = @_ ? 0 : 1;
   my $count = $self->count();
   if ($count < 1 + $div) {
@@ -234,7 +237,7 @@
 
 use vars qw($VERSION);
 
-$VERSION = '3.0202';
+$VERSION = '3.0300';
 
 use Carp;
 
@@ -368,22 +371,26 @@
 }
 
 sub percentile {
-  my $self = shift;
-  my $percentile = shift || 0;
-  ##Since we're returning a single value there's no real need
-  ##to cache this.
-
-  ##If the requested percentile is less than the "percentile bin
-  ##size" then return undef.  Check description of RFC 2330 in the
-  ##POD below.
-  my $count = $self->count();
-  return undef if $percentile < 100 / $count;
+    my $self = shift;
+    my $percentile = shift || 0;
+    ##Since we're returning a single value there's no real need
+    ##to cache this.
+
+    ##If the requested percentile is less than the "percentile bin
+    ##size" then return undef.  Check description of RFC 2330 in the
+    ##POD below.
+    my $count = $self->count();
 
-  $self->sort_data();
-  my $num = $count*$percentile/100;
-  my $index = &POSIX::ceil($num) - 1;
-  my $val = $self->_data->[$index];
-  return wantarray
+    if ((! $count) || ($percentile < 100 / $count))
+    {
+        return;  #  allow for both scalar and list context
+    }
+
+    $self->sort_data();
+    my $num = $count*$percentile/100;
+    my $index = &POSIX::ceil($num) - 1;
+    my $val = $self->_data->[$index];
+    return wantarray
     ? ($val, $index)
     : $val
     ;
@@ -411,6 +418,8 @@
 sub median {
     my $self = shift;
 
+    return if !$self->count;    
+    
     ##Cached?
     if (! defined($self->_median()))
     {
@@ -428,6 +437,9 @@
        return;
     }
     
+    #  check data count after the args are checked - should help debugging
+    return if !$self->count;  
+    
     $self->sort_data();
 
     return $self->_data->[0] if ( $QuantileNumber == 0 );
@@ -490,6 +502,9 @@
         ($lower,$upper) = ($_[0],$_[1]);
     }
 
+    #  check data count after the args
+    return if !$self->count;    
+
     ##Cache
     my $thistm = join ':',$lower,$upper;
     my $cache = $self->_trimmed_mean_cache();
@@ -581,6 +596,8 @@
 
 sub geometric_mean {
     my $self = shift;
+    
+    return if !$self->count;
 
     if (!defined($self->_geometric_mean()))
     {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Statistics-Descriptive-3.0202/t/descr.t 
new/Statistics-Descriptive-3.0300/t/descr.t
--- old/Statistics-Descriptive-3.0202/t/descr.t 2011-07-23 15:11:05.000000000 
+0200
+++ new/Statistics-Descriptive-3.0300/t/descr.t 2012-02-11 11:23:07.000000000 
+0100
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 28;
+use Test::More tests => 50;
 
 use Benchmark;
 use Statistics::Descriptive;
@@ -80,7 +80,7 @@
     my $stat = Statistics::Descriptive::Full->new();
     my @results = $stat->least_squares_fit();
     # TEST
-    ok (!scalar(@results), "Results on an non-filled object are empty.");
+    ok (!scalar(@results), "Least-squares results on a non-filled object are 
empty.");
 
     # test #2
     # data are y = 2*x - 1
@@ -413,3 +413,64 @@
 
 }
 
+{
+    # This is a fix for:
+    # https://rt.cpan.org/Ticket/Display.html?id=72495
+    # Thanks to Robert Messer
+    my $stat = Statistics::Descriptive::Full->new();
+
+    my $ret = $stat->percentile(100);
+
+    # TEST
+    ok (!defined($ret), 'Returns undef and does not die.');
+}
+
+
+
+#  test stats when no data have been added
+{
+    my $stat = Statistics::Descriptive::Full->new();
+    my ($result, $str);
+
+    #  An accessor method for _permitted would be handy,
+    #  or one to get all the stats methods
+    my @methods = qw {
+        mean sum variance standard_deviation
+        min mindex max maxdex sample_range
+        skewness kurtosis median
+        harmonic_mean geometric_mean
+        mode least_squares_fit
+        percentile frequency_distribution 
+    };
+    #  least_squares_fit is handled in an earlier test, so is actually a 
duplicate here
+    
+    #diag 'Results are undef when no data added';
+    #  need to update next line when new methods are tested here
+    # TEST:$method_count=18
+    foreach my $method (sort @methods) {  
+        $result = $stat->$method;
+        # TEST*$method_count
+        ok (!defined ($result), "$method is undef when object has no data.");
+    }
+
+    #  quantile and trimmed_mean require valid args, so don't test in the 
method loop
+    my $method = 'quantile';
+    $result = $stat->$method(1);
+    # TEST
+    ok (!defined ($result), "$method is undef when object has no data.");
+    
+    $method = 'trimmed_mean';
+    $result = $stat->$method(0.1);
+    # TEST
+    ok (!defined ($result), "$method is undef when object has no data.");    
+}
+
+#  test SD when only one value added
+{
+    my $stat = Statistics::Descriptive::Full->new();
+    $stat->add_data( 1 );
+
+    my $result = $stat->standard_deviation();
+    # TEST
+    ok ($result == 0, "SD is zero when object has one record.");
+}

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to