New Upstream Snapshot - libnet-statsd-perl

Ready changes

Summary

Merged new upstream version: 0.12+git20160312.1.81a4dd2 (was: 0.12).

Resulting package

Built on 2023-01-11T10:24 (took 9m58s)

The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:

apt install -t fresh-snapshots libnet-statsd-perl

Lintian Result

Diff

diff --git a/INSTALL b/INSTALL
index 3fe9fd7..9bc1f08 100644
--- a/INSTALL
+++ b/INSTALL
@@ -8,10 +8,10 @@ If you have cpanm, you only need one line:
 
     % cpanm Net::Statsd
 
-If you are installing into a system-wide directory, you may need to pass the
-"-S" flag to cpanm, which uses sudo to install the module:
-
-    % cpanm -S Net::Statsd
+If it does not have permission to install modules to the current perl, cpanm
+will automatically set up and install to a local::lib in your home directory.
+See the local::lib documentation (https://metacpan.org/pod/local::lib) for
+details on enabling it in your environment.
 
 ## Installing with the CPAN shell
 
@@ -21,8 +21,11 @@ Alternatively, if your CPAN shell is set up, you should just be able to do:
 
 ## Manual installation
 
-As a last resort, you can manually install it. Download the tarball, untar it,
-then build it:
+As a last resort, you can manually install it. If you have not already
+downloaded the release tarball, you can find the download link on the module's
+MetaCPAN page: https://metacpan.org/pod/Net::Statsd
+
+Untar the tarball, install configure prerequisites (see below), then build it:
 
     % perl Makefile.PL
     % make && make test
@@ -31,13 +34,42 @@ Then install it:
 
     % make install
 
-If you are installing into a system-wide directory, you may need to run:
+On Windows platforms, you should use `dmake` or `nmake`, instead of `make`.
+
+If your perl is system-managed, you can create a local::lib in your home
+directory to install modules to. For details, see the local::lib documentation:
+https://metacpan.org/pod/local::lib
+
+The prerequisites of this distribution will also have to be installed manually. The
+prerequisites are listed in one of the files: `MYMETA.yml` or `MYMETA.json` generated
+by running the manual build process described above.
+
+## Configure Prerequisites
 
-    % sudo make install
+This distribution requires other modules to be installed before this
+distribution's installer can be run.  They can be found under the
+"configure_requires" key of META.yml or the
+"{prereqs}{configure}{requires}" key of META.json.
+
+## Other Prerequisites
+
+This distribution may require additional modules to be installed after running
+Makefile.PL.
+Look for prerequisites in the following phases:
+
+* to run make, PHASE = build
+* to use the module code itself, PHASE = runtime
+* to run tests, PHASE = test
+
+They can all be found in the "PHASE_requires" key of MYMETA.yml or the
+"{prereqs}{PHASE}{requires}" key of MYMETA.json.
 
 ## Documentation
 
 Net-Statsd documentation is available as POD.
-You can run perldoc from a shell to read the documentation:
+You can run `perldoc` from a shell to read the documentation:
 
     % perldoc Net::Statsd
+
+For more information on installing Perl modules via CPAN, please see:
+https://www.cpan.org/modules/INSTALL.html
diff --git a/LICENSE b/LICENSE
index 587f020..7efc4a3 100644
--- a/LICENSE
+++ b/LICENSE
@@ -22,7 +22,7 @@ This is free software, licensed under:
                      Version 1, February 1989
 
  Copyright (C) 1989 Free Software Foundation, Inc.
- 51 Franklin St, Suite 500, Boston, MA  02110-1335  USA
+ 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
  Everyone is permitted to copy and distribute verbatim copies
  of this license document, but changing it is not allowed.
@@ -292,21 +292,21 @@ Definitions:
 
   - "Package" refers to the collection of files distributed by the Copyright
     Holder, and derivatives of that collection of files created through
-    textual modification. 
+    textual modification.
   - "Standard Version" refers to such a Package if it has not been modified,
     or has been modified in accordance with the wishes of the Copyright
-    Holder. 
+    Holder.
   - "Copyright Holder" is whoever is named in the copyright or copyrights for
-    the package. 
+    the package.
   - "You" is you, if you're thinking about copying or distributing this Package.
   - "Reasonable copying fee" is whatever you can justify on the basis of media
     cost, duplication charges, time of people involved, and so on. (You will
     not be required to justify it to the Copyright Holder, but only to the
-    computing community at large as a market that must bear the fee.) 
+    computing community at large as a market that must bear the fee.)
   - "Freely Available" means that no fee is charged for the item itself, though
     there may be fees involved in handling the item. It also means that
     recipients of the item may redistribute it under the same conditions they
-    received it. 
+    received it.
 
 1. You may make and give away verbatim copies of the source form of the
 Standard Version of this Package without restriction, provided that you
@@ -373,7 +373,7 @@ products derived from this software without specific prior written permission.
 
 9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
 WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
-MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 
 The End
 
diff --git a/MANIFEST b/MANIFEST
index f254218..381883f 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1,4 +1,4 @@
-# This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.008.
+# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.029.
 Changes
 INSTALL
 LICENSE
diff --git a/META.json b/META.json
index 43063a3..3ff1efb 100644
--- a/META.json
+++ b/META.json
@@ -4,24 +4,25 @@
       "Cosimo Streppone <cosimo@cpan.org>"
    ],
    "dynamic_config" : 0,
-   "generated_by" : "Dist::Zilla version 5.008, CPAN::Meta::Converter version 2.143240",
+   "generated_by" : "Dist::Zilla version 6.029, CPAN::Meta::Converter version 2.150010",
    "license" : [
       "perl_5"
    ],
    "meta-spec" : {
       "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
-      "version" : "2"
+      "version" : 2
    },
    "name" : "Net-Statsd",
    "prereqs" : {
       "configure" : {
          "requires" : {
-            "ExtUtils::MakeMaker" : "6.30"
+            "ExtUtils::MakeMaker" : "0"
          }
       },
       "runtime" : {
          "requires" : {
-            "IO::Socket" : "0"
+            "IO::Socket" : "0",
+            "Time::HiRes" : "0"
          }
       },
       "test" : {
@@ -42,6 +43,9 @@
          "web" : "http://github.com/cosimo/perl5-net-statsd"
       }
    },
-   "version" : "0.12"
+   "version" : "0.12",
+   "x_generated_by_perl" : "v5.36.0",
+   "x_serialization_backend" : "Cpanel::JSON::XS version 4.32",
+   "x_spdx_expression" : "Artistic-1.0-Perl OR GPL-1.0-or-later"
 }
 
diff --git a/META.yml b/META.yml
index 70719ae..e893fef 100644
--- a/META.yml
+++ b/META.yml
@@ -3,19 +3,23 @@ abstract: "Perl client for Etsy's statsd daemon"
 author:
   - 'Cosimo Streppone <cosimo@cpan.org>'
 build_requires:
-  Test::More: 0
+  Test::More: '0'
 configure_requires:
-  ExtUtils::MakeMaker: 6.30
+  ExtUtils::MakeMaker: '0'
 dynamic_config: 0
-generated_by: 'Dist::Zilla version 5.008, CPAN::Meta::Converter version 2.143240'
+generated_by: 'Dist::Zilla version 6.029, CPAN::Meta::Converter version 2.150010'
 license: perl
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
-  version: 1.4
+  version: '1.4'
 name: Net-Statsd
 requires:
-  IO::Socket: 0
+  IO::Socket: '0'
+  Time::HiRes: '0'
 resources:
   bugtracker: http://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-Statsd
   repository: git://github.com/cosimo/perl5-net-statsd.git
-version: 0.12
+version: '0.12'
+x_generated_by_perl: v5.36.0
+x_serialization_backend: 'YAML::Tiny version 1.73'
+x_spdx_expression: 'Artistic-1.0-Perl OR GPL-1.0-or-later'
diff --git a/Makefile.PL b/Makefile.PL
index 1d950b8..44b2ccb 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -1,20 +1,16 @@
-
-# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v5.008.
+# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.029.
 use strict;
 use warnings;
 
 
 
-use ExtUtils::MakeMaker 6.30;
-
-
+use ExtUtils::MakeMaker;
 
 my %WriteMakefileArgs = (
   "ABSTRACT" => "Perl client for Etsy's statsd daemon",
   "AUTHOR" => "Cosimo Streppone <cosimo\@cpan.org>",
-  "BUILD_REQUIRES" => {},
   "CONFIGURE_REQUIRES" => {
-    "ExtUtils::MakeMaker" => "6.30"
+    "ExtUtils::MakeMaker" => 0
   },
   "DISTNAME" => "Net-Statsd",
   "EXE_FILES" => [
@@ -23,7 +19,8 @@ my %WriteMakefileArgs = (
   "LICENSE" => "perl",
   "NAME" => "Net::Statsd",
   "PREREQ_PM" => {
-    "IO::Socket" => 0
+    "IO::Socket" => 0,
+    "Time::HiRes" => 0
   },
   "TEST_REQUIRES" => {
     "Test::More" => 0
@@ -37,7 +34,8 @@ my %WriteMakefileArgs = (
 
 my %FallbackPrereqs = (
   "IO::Socket" => 0,
-  "Test::More" => 0
+  "Test::More" => 0,
+  "Time::HiRes" => 0
 );
 
 
@@ -51,6 +49,3 @@ delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
   unless eval { ExtUtils::MakeMaker->VERSION(6.52) };
 
 WriteMakefile(%WriteMakefileArgs);
-
-
-
diff --git a/README b/README
index d6524da..b759d20 100644
--- a/README
+++ b/README
@@ -1,5 +1,3 @@
-
-
 This archive contains the distribution Net-Statsd,
 version 0.12:
 
@@ -11,5 +9,4 @@ This is free software; you can redistribute it and/or modify it under
 the same terms as the Perl 5 programming language system itself.
 
 
-This README file was generated by Dist::Zilla::Plugin::Readme v5.008.
-
+This README file was generated by Dist::Zilla::Plugin::Readme v6.029.
diff --git a/debian/changelog b/debian/changelog
index ee3a408..65b6356 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,9 @@
-libnet-statsd-perl (0.12-4) UNRELEASED; urgency=medium
+libnet-statsd-perl (0.12+git20160312.1.81a4dd2-1) UNRELEASED; urgency=medium
 
   * Set upstream metadata fields: Repository-Browse.
+  * New upstream snapshot.
 
- -- Debian Janitor <janitor@jelmer.uk>  Wed, 11 Jan 2023 05:42:13 -0000
+ -- Debian Janitor <janitor@jelmer.uk>  Wed, 11 Jan 2023 10:19:43 -0000
 
 libnet-statsd-perl (0.12-3) unstable; urgency=medium
 
diff --git a/dist.ini b/dist.ini
index f339737..0183d8d 100644
--- a/dist.ini
+++ b/dist.ini
@@ -27,6 +27,7 @@ repository.type   = git
 
 [Prereqs]
 IO::Socket = 0
+Time::HiRes = 0
 
 [Prereqs / TestRequires]
 Test::More = 0
diff --git a/lib/Net/Statsd.pm b/lib/Net/Statsd.pm
index 2e1bd92..95e62f4 100644
--- a/lib/Net/Statsd.pm
+++ b/lib/Net/Statsd.pm
@@ -1,14 +1,12 @@
 package Net::Statsd;
-{
-  $Net::Statsd::VERSION = '0.12';
-}
-
+$Net::Statsd::VERSION = '0.12';
 # ABSTRACT: Perl client for Etsy's statsd daemon
 
 use strict;
 use warnings;
 use Carp ();
 use IO::Socket ();
+use Time::HiRes ();
 
 our $HOST = 'localhost';
 our $PORT = 8125;
@@ -33,6 +31,19 @@ sub timing {
 }
 
 
+sub get_timer {
+    my ( $name, $sample_rate ) = @_;
+    my $start = [Time::HiRes::gettimeofday];
+    return sub {
+        Net::Statsd::timing(
+            $name,
+            Time::HiRes::tv_interval($start) * 1000,
+            $sample_rate,
+        );
+    };
+}
+
+
 sub increment {
     my ($stats, $sample_rate) = @_;
 
@@ -296,6 +307,15 @@ B<Time is assumed to be in milliseconds (ms)>.
 
     Net::Statsd::timing('some.timer', 500);
 
+=head2 C<get_timer($name, $sample_rate = 1)>
+
+Start timer for the metric. Function returns timer object. When you call this
+object, it sends timing data to statsd.
+
+    my $timer = Net::Statsd::get_timer('my.func.time');
+    ...; # here comes your code
+    $timer->(); # send timing to server
+
 =head2 C<increment($counter, $sample_rate=1)>
 
 =head2 C<increment(\@counter, $sample_rate=1)>
diff --git a/t/mock-server.t b/t/mock-server.t
index a1f27ef..04c4a92 100644
--- a/t/mock-server.t
+++ b/t/mock-server.t
@@ -19,7 +19,7 @@ BEGIN {
 
 use strict;
 use warnings;
-use Test::More tests => 17;
+use Test::More tests => 18;
 use Net::Statsd;
 
 my $dirname;
@@ -54,6 +54,16 @@ is_deeply($msgs, [ {
     _raw_data => 'test.timer:345|ms'
 } ], "Sent 1 timing event. Received correctly.");
 
+my $timer = Net::Statsd::get_timer('test.get_timer');
+$timer->();
+$msgs = MockServer::get_and_reset_messages();
+my $time_ms = $msgs->[0]{timers}[0];
+is_deeply($msgs, [ {
+    key => 'test.get_timer',
+    timers => [ $time_ms ],
+    _raw_data => "test.get_timer:$time_ms|ms"
+} ], "Sent 1 timing event. Received correctly.");
+
 Net::Statsd::increment('test.counter');
 $msgs = MockServer::get_and_reset_messages();
 is_deeply($msgs, [ {

Debdiff

File lists identical (after any substitutions)

No differences were encountered in the control files

More details

Full run details