Data-Promise

 view release on metacpan or  search on metacpan

META.json  view on Meta::CPAN

            "ExtUtils::MakeMaker" : "0"
         }
      },
      "configure" : {
         "requires" : {
            "ExtUtils::MakeMaker" : "0"
         }
      },
      "runtime" : {
         "requires" : {
            "Modern::Perl" : "1.20170117",
            "Moo" : "2.003002",
            "MooX::Types::MooseLike::Base" : "0.29",
            "namespace::clean" : "0.27"
         }
      },
      "test" : {
         "requires" : {
            "Test::More" : "1.302073"
         }
      }

META.yml  view on Meta::CPAN

license: perl
meta-spec:
  url: http://module-build.sourceforge.net/META-spec-v1.4.html
  version: '1.4'
name: Data-Promise
no_index:
  directory:
    - t
    - inc
requires:
  Modern::Perl: '1.20170117'
  Moo: '2.003002'
  MooX::Types::MooseLike::Base: '0.29'
  namespace::clean: '0.27'
version: 0.001
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'

Makefile.PL  view on Meta::CPAN

use ExtUtils::MakeMaker;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
WriteMakefile(
    NAME              => 'Data::Promise',
    VERSION_FROM      => 'lib/Data/Promise.pm', # finds $VERSION
    LICENSE=>'perl_5',
    PREREQ_PM         => {
    qw(
      Moo  2.003002
      Modern::Perl 1.20170117
      MooX::Types::MooseLike::Base 0.29
      namespace::clean 0.27
    )
    
    }, # e.g., Module::Name => 1.1
    TEST_REQUIRES=>{
      qw( 
        Test::More    1.302073
      )
    },

lib/Data/Promise.pm  view on Meta::CPAN

package Data::Promise;

=head1 NAME

Data::Promise - simple promise like interface

=head1 SYNOPSIS

  use Modern::Perl;
  use Data::Promose;

  my $p=new Data::Promise(cb=>sub {
    my ($resolve,$reject)=@_;

    if(...) {
      # pass context
      $resolve->('ok');
    } else {
      $reject->('something went wrong');

lib/Data/Promise.pm  view on Meta::CPAN

  $p->then(\&pass_function,\&fail_function);

=head1 DESCRIPTION

A light and simple Promise object based on the current es6 implementation.   This promise object class was written to mimic how promise(s) are implemnted in the wild.  This may or may not be the class you are looking for.

=cut

our $VERSION=0.001;

use Modern::Perl;
use Moo;
use MooX::Types::MooseLike::Base qw(:all);

use namespace::clean;

=head1 OO Constructor Arguments

=over 4

=item * cb=>sub { my ($resovle,$reject)=@_ }

t/Data-Promose.t  view on Meta::CPAN

use Modern::Perl;
use Test::More;

my $class='Data::Promise';

use_ok($class);
require_ok($class);

{
  my $p=$class->new(cb=>sub { $_[0]->(42) },delayed=>1);



( run in 0.517 second using v1.01-cache-2.11-cpan-a5abf4f5562 )