Permalink
Browse files

minil migrate'd

  • Loading branch information...
1 parent 3247a2d commit 4b9417d2980c4d631dbfc3506caf55ebcbf4cda4 @lestrrat committed Apr 18, 2013
Showing with 264 additions and 8 deletions.
  1. +7 −0 .gitignore
  2. +68 −0 Build.PL
  3. +1 −0 LICENSE
  4. +72 −0 META.json
  5. +0 −8 Makefile.PL
  6. +110 −0 README.md
  7. +6 −0 cpanfile
View
@@ -19,3 +19,10 @@ MANIFEST.bak
cover_db
.build*
AnyEvent-FIFO-*
+/AnyEvent-FIFO-*
+/.build
+/_build_params
+/Build
+!Build/
+!META.json
+extlib
View
@@ -0,0 +1,68 @@
+# =========================================================================
+# THIS FILE IS AUTOMATICALLY GENERATED BY MINILLA.
+# DO NOT EDIT DIRECTLY.
+# =========================================================================
+
+use 5.008_001;
+
+use strict;
+use warnings;
+use utf8;
+
+use Module::Build;
+use File::Basename;
+use File::Spec;
+use CPAN::Meta;
+use CPAN::Meta::Prereqs;
+
+my %args = (
+ license => 'perl',
+ dynamic_config => 0,
+
+ configure_requires => {
+ 'Module::Build' => 0.38,
+ },
+
+ no_index => { 'directory' => [ 'inc' ] },
+ name => 'AnyEvent-FIFO',
+ module_name => 'AnyEvent::FIFO',
+
+ script_files => [glob('script/*'), glob('bin/*')],
+
+ test_files => ((-d '.git' || $ENV{RELEASE_TESTING}) && -d 'xt') ? 't/ xt/' : 't/',
+ recursive_test_files => 1,
+);
+if (-d 'share') {
+ $args{share_dir} = 'share';
+}
+
+my $builder = Module::Build->subclass(
+ class => 'MyBuilder',
+ code => q{
+ sub ACTION_distmeta {
+ die "Do not run distmeta. Install Minilla and `minil install` instead.\n";
+ }
+ sub ACTION_installdeps {
+ die "Do not run installdeps. Run `cpanm --installdeps .` instead.\n";
+ }
+ }
+)->new(%args);
+$builder->create_build_script();
+
+my $mbmeta = CPAN::Meta->load_file('MYMETA.json');
+my $meta = CPAN::Meta->load_file('META.json');
+my $prereqs_hash = CPAN::Meta::Prereqs->new(
+ $meta->prereqs
+)->with_merged_prereqs(
+ CPAN::Meta::Prereqs->new($mbmeta->prereqs)
+)->as_string_hash;
+my $mymeta = CPAN::Meta->new(
+ {
+ %{$meta->as_struct},
+ prereqs => $prereqs_hash
+ }
+);
+print "Merging cpanfile prereqs to MYMETA.yml\n";
+$mymeta->save('MYMETA.yml', { version => 1.4 });
+print "Merging cpanfile prereqs to MYMETA.json\n";
+$mymeta->save('MYMETA.json', { version => 2 });
View
@@ -0,0 +1 @@
+Minilla cannot detect license terms.
View
@@ -0,0 +1,72 @@
+{
+ "abstract" : "Simple FIFO Callback Dispatch",
+ "author" : [
+ "This module is basically a generalisation of the FIFO queue used in AnyEvent::HTTP by Marc Lehman."
+ ],
+ "dynamic_config" : 0,
+ "generated_by" : "Minilla/v0.0.53, CPAN::Meta::Converter version 2.120921",
+ "license" : [
+ "unknown"
+ ],
+ "meta-spec" : {
+ "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
+ "version" : "2"
+ },
+ "name" : "AnyEvent-FIFO",
+ "no_index" : {
+ "directory" : [
+ "t",
+ "xt",
+ "inc",
+ "share",
+ "eg",
+ "examples",
+ "author"
+ ]
+ },
+ "prereqs" : {
+ "build" : {
+ "requires" : {
+ "ExtUtils::MakeMaker" : "6.36",
+ "Test::More" : "0"
+ }
+ },
+ "configure" : {
+ "requires" : {
+ "CPAN::Meta" : "0",
+ "CPAN::Meta::Prereqs" : "0",
+ "Module::Build" : "0.38"
+ }
+ },
+ "develop" : {
+ "requires" : {
+ "Test::CPAN::Meta" : "0",
+ "Test::MinimumVersion" : "0.10108",
+ "Test::Pod" : "1.41",
+ "Test::Spellunker" : "v0.0.3"
+ }
+ },
+ "runtime" : {
+ "requires" : {
+ "AnyEvent" : "0"
+ }
+ }
+ },
+ "release_status" : "unstable",
+ "resources" : {
+ "bugtracker" : {
+ "web" : "https://github.com/lestrrat/AnyEvent-FIFO/issues"
+ },
+ "homepage" : "https://github.com/lestrrat/AnyEvent-FIFO",
+ "repository" : {
+ "type" : "git",
+ "url" : "git://github.com/lestrrat/AnyEvent-FIFO.git",
+ "web" : "https://github.com/lestrrat/AnyEvent-FIFO"
+ }
+ },
+ "version" : "0.00002",
+ "x_contributors" : [
+ "kolya <mar.kolya@gmail.com>",
+ "lestrrat <lestrrat+github@gmail.com>"
+ ]
+}
View
@@ -1,8 +0,0 @@
-use inc::Module::Install;
-
-name 'AnyEvent-FIFO';
-all_from 'lib/AnyEvent/FIFO.pm';
-requires 'AnyEvent';
-test_requires 'Test::More';
-auto_install;
-WriteAll;
View
110 README.md
@@ -0,0 +1,110 @@
+# NAME
+
+AnyEvent::FIFO - Simple FIFO Callback Dispatch
+
+# SYNOPSIS
+
+ my $fifo = AnyEvent::FIFO->new(
+ max_active => 1, # max "concurrent" callbacks to execute per slot
+ );
+
+ # send to the "default" slot
+ $fifo->push( \&callback, @args );
+
+ # send to the "slot" slot
+ $fifo->push( "slot", \&callback, @args );
+
+ # dispatch is done automatically
+ # wait for all tasks to complete
+ $fifo->cv->recv();
+
+ sub callback {
+ my ($guard, @args) = @_;
+
+ # next callback will be executed when $guard is undef'ed or
+ # when it goes out of scope
+ }
+
+# DESCRIPTION
+
+AnyEvent::FIFO is a simple FIFO queue to dispatch events in order.
+
+If you use regular watchers and register callbacks from various places in
+your program, you're not necessarily guaranteed that the callbacks will be
+executed in the order that you expect. By using this module, you can
+register callbacks and they will be executed in that particular order.
+
+# METHODS
+
+## new
+
+- max\_active => $number
+
+ Number of concurrent callbacks to be executed __per slot__.
+
+- cv => $cv
+
+ Instance of [AnyEvent condvar](http://search.cpan.org/perldoc?AnyEvent#CONDITION VARIABLES). AnyEvent::FIFO will create one for you if this is not provided.
+
+ AnyEvent::FIFO calls $cv->begin() when new task is pushed and $cv->end() when task is completed.
+
+## push (\[$slot,\] $cb \[,@args\])
+
+- $slot
+
+ The name of the slot that this callback should be registered to. If $slot is
+ not specified, "\_\_default\_\_" is used.
+
+- $cb
+
+ The callback to be executed. Receives a "guard" object, and a list of arguments, as specied in @args.
+
+ $guard is the actually trigger that kicks the next callback to be executed, so you should keep it "alive" while you need it. For example, if you need to make an http request to declare the callback done, you should do something like this:
+
+ $fifo->push( sub {
+ my ($guard, @args) = @_;
+
+ http_get $uri, sub {
+ ...
+ undef $guard; # *NOW* the callback is done
+ }
+ } );
+
+- @args
+
+ List of extra arguments that gets passed to the callback
+
+## active (\[$slot\])
+
+Returns number of active tasks for a given slot.
+
+- $slot
+
+ The name of the slot, "\_\_default\_\_" is used if not specified.
+
+## waiting (\[$slot\])
+
+Returns number of waiting tasks for a given slot.
+
+- $slot
+
+ The name of the slot, "\_\_default\_\_" is used if not specified.
+
+## cv (\[$cv\])
+
+Gets or sets [AnyEvent condvar](http://search.cpan.org/perldoc?AnyEvent#CONDITION VARIABLES).
+
+- $cv
+
+ A new condvar to assign to this FIFO
+
+## drain
+
+Attemps to drain the queue, if possible. You DO NOT need to call this method
+by yourself. It's handled automatically
+
+# AUTHOR
+
+This module is basically a generalisation of the FIFO queue used in AnyEvent::HTTP by Marc Lehman.
+
+(c) Daisuke Maki ` <<daisuke@endeworks.jp`\> > 2010
View
@@ -0,0 +1,6 @@
+requires 'AnyEvent';
+
+on build => sub {
+ requires 'ExtUtils::MakeMaker', '6.36';
+ requires 'Test::More';
+};

0 comments on commit 4b9417d

Please sign in to comment.