The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
.travis.yml 09
Changes 03
LICENSE 03
MANIFEST 23
MANIFEST.SKIP 01
META.json 33
META.yml 99
MYMETA.json 480
MYMETA.yml 260
Makefile.PL 01
README 22
Throttler.pm 34
eg/forktest 050
13 files changed (This is a version diff) 9388
@@ -0,0 +1,9 @@
+language: perl
+
+perl:
+    - "5.20"
+    - "5.18"
+    - "5.16"
+    - "5.14"
+    - "5.12"
+    - "5.10"
@@ -1,6 +1,9 @@
 ######################################################################
 Revision history for Perl extension Data::Throttler
 
+0.07 (2015/06/08)
+    (ms) Chris Kirke added a license and Travis CI integration.
+
 0.06 (2013/05/23)
     (ms) [rt.cpan.org 85325] Added better diagnostics in case locking
          of db_file fails, as suggested by Nigel Horne.
@@ -0,0 +1,3 @@
+Copyright 2007 by Mike Schilli, all rights reserved.
+This program is free software, you can redistribute it and/or
+modify it under the same terms as Perl itself.
@@ -1,11 +1,12 @@
+.travis.yml
 Changes
 eg/example
+eg/forktest
 eg/persist
+LICENSE
 Makefile.PL
 MANIFEST			This list of files
 MANIFEST.SKIP
-MYMETA.json
-MYMETA.yml
 README
 t/001Basic.t
 t/002File.t
@@ -7,3 +7,4 @@ CVS
 docs
 MANIFEST.bak
 adm/release
+MYMETA
@@ -4,9 +4,9 @@
       "Mike Schilli <cpan@perlmeister.com>"
    ],
    "dynamic_config" : 1,
-   "generated_by" : "ExtUtils::MakeMaker version 6.62, CPAN::Meta::Converter version 2.120351",
+   "generated_by" : "ExtUtils::MakeMaker version 7.04, CPAN::Meta::Converter version 2.142690",
    "license" : [
-      "unknown"
+      "perl_5"
    ],
    "meta-spec" : {
       "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
@@ -44,5 +44,5 @@
          "url" : "http://github.com/mschilli/data-throttler-perl"
       }
    },
-   "version" : "0.06"
+   "version" : "0.07"
 }
@@ -3,24 +3,24 @@ abstract: 'Limit data throughput'
 author:
   - 'Mike Schilli <cpan@perlmeister.com>'
 build_requires:
-  ExtUtils::MakeMaker: 0
+  ExtUtils::MakeMaker: '0'
 configure_requires:
-  ExtUtils::MakeMaker: 0
+  ExtUtils::MakeMaker: '0'
 dynamic_config: 1
-generated_by: 'ExtUtils::MakeMaker version 6.62, CPAN::Meta::Converter version 2.120351'
-license: unknown
+generated_by: 'ExtUtils::MakeMaker version 7.04, CPAN::Meta::Converter version 2.142690'
+license: perl
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
-  version: 1.4
+  version: '1.4'
 name: Data-Throttler
 no_index:
   directory:
     - t
     - inc
 requires:
-  Log::Log4perl: 1
-  Set::IntSpan: 0
-  YAML: 0.62
+  Log::Log4perl: '1'
+  Set::IntSpan: '0'
+  YAML: '0.62'
 resources:
   repository: http://github.com/mschilli/data-throttler-perl
-version: 0.06
+version: '0.07'
@@ -1,48 +0,0 @@
-{
-   "abstract" : "Limit data throughput",
-   "author" : [
-      "Mike Schilli <cpan@perlmeister.com>"
-   ],
-   "dynamic_config" : 0,
-   "generated_by" : "ExtUtils::MakeMaker version 6.62, CPAN::Meta::Converter version 2.120351",
-   "license" : [
-      "unknown"
-   ],
-   "meta-spec" : {
-      "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
-      "version" : "2"
-   },
-   "name" : "Data-Throttler",
-   "no_index" : {
-      "directory" : [
-         "t",
-         "inc"
-      ]
-   },
-   "prereqs" : {
-      "build" : {
-         "requires" : {
-            "ExtUtils::MakeMaker" : "0"
-         }
-      },
-      "configure" : {
-         "requires" : {
-            "ExtUtils::MakeMaker" : "0"
-         }
-      },
-      "runtime" : {
-         "requires" : {
-            "Log::Log4perl" : "1",
-            "Set::IntSpan" : "0",
-            "YAML" : "0.62"
-         }
-      }
-   },
-   "release_status" : "stable",
-   "resources" : {
-      "repository" : {
-         "url" : "http://github.com/mschilli/data-throttler-perl"
-      }
-   },
-   "version" : "0.06"
-}
@@ -1,26 +0,0 @@
----
-abstract: 'Limit data throughput'
-author:
-  - 'Mike Schilli <cpan@perlmeister.com>'
-build_requires:
-  ExtUtils::MakeMaker: 0
-configure_requires:
-  ExtUtils::MakeMaker: 0
-dynamic_config: 0
-generated_by: 'ExtUtils::MakeMaker version 6.62, CPAN::Meta::Converter version 2.120351'
-license: unknown
-meta-spec:
-  url: http://module-build.sourceforge.net/META-spec-v1.4.html
-  version: 1.4
-name: Data-Throttler
-no_index:
-  directory:
-    - t
-    - inc
-requires:
-  Log::Log4perl: 1
-  Set::IntSpan: 0
-  YAML: 0.62
-resources:
-  repository: http://github.com/mschilli/data-throttler-perl
-version: 0.06
@@ -6,6 +6,7 @@ use ExtUtils::MakeMaker;
 
 my $meta_merge = {
     META_MERGE => {
+        license   => [ 'perl_5' ],
         resources => {
             repository  => 'http://github.com/mschilli/data-throttler-perl',
         },
@@ -1,5 +1,5 @@
 ######################################################################
-    Data::Throttler 0.06
+    Data::Throttler 0.07
 ######################################################################
 
 NAME
@@ -216,7 +216,7 @@ DESCRIPTION
 
     and allow for further investigation.
 
-LEGALESE
+LICENSE
     Copyright 2007 by Mike Schilli, all rights reserved. This program is
     free software, you can redistribute it and/or modify it under the same
     terms as Perl itself.
@@ -5,7 +5,7 @@ use strict;
 use warnings;
 use Log::Log4perl qw(:easy);
 
-our $VERSION    = "0.06";
+our $VERSION    = "0.07";
 our $DB_VERSION = "1.1";
 
 ###########################################
@@ -103,8 +103,9 @@ sub create {
 sub lock {
 ###########################################
     my($self) = @_;
-    DEBUG "Lock on";
+    DEBUG "Trying to get lock ($$)";
     $self->{db}->lock();
+    DEBUG "Lock on ($$)";
 }
 
 ###########################################
@@ -865,7 +866,7 @@ will print out something like
 
 and allow for further investigation.
 
-=head1 LEGALESE
+=head1 LICENSE
 
 Copyright 2007 by Mike Schilli, all rights reserved.
 This program is free software, you can redistribute it and/or
@@ -0,0 +1,50 @@
+#!/usr/bin/perl -w
+use strict;
+use Log::Log4perl qw(:easy);
+
+# Log::Log4perl->easy_init({ level => $DEBUG, layout => "%F{1}:%L %m%n"});
+
+use Data::Throttler;
+
+my $db_file = "db_file.dat";
+
+unlink $db_file;
+
+my $throttler = Data::Throttler->new(
+    interval  => 120,
+    max_items =>  1000,
+    backend => 'YAML',
+    backend_options => {
+        db_file => $db_file,
+    }
+);
+
+my $pid = fork();
+
+if( !defined $pid ) {
+    die "fork failed: $!";
+}
+
+if( $pid ) {
+    # parent
+    push_test( $throttler );
+    DEBUG "Parent done";
+    waitpid( $pid, 0 );
+} else {
+    # child
+    push_test( $throttler );
+    DEBUG "Child done";
+    exit 0;
+}
+
+###########################################
+sub push_test {
+###########################################
+    my( $throttler ) = @_;
+
+    for( 1... 100 ) {
+        $throttler->try_push(key => "foobar");
+        $throttler->try_push(key => "foobar");
+        $throttler->try_push(key => "foobar");
+    }
+}