Data-Result

 view release on metacpan or  search on metacpan

META.json  view on Meta::CPAN

      },
      "configure" : {
         "requires" : {
            "ExtUtils::MakeMaker" : "0"
         }
      },
      "runtime" : {
         "requires" : {
            "Carp" : "1.42",
            "Data::Dumper" : "2.161",
            "Modern::Perl" : "1.20170117",
            "Moo" : "2.003002",
            "MooX::Types::MooseLike::Base" : "0.29",
            "Scalar::Util" : "0",
            "Test::More" : "1.302073",
            "boolean" : "0.46",
            "namespace::clean" : "0.27",
            "overload" : "1.28"
         }
      }
   },

META.yml  view on Meta::CPAN

  url: http://module-build.sourceforge.net/META-spec-v1.4.html
  version: '1.4'
name: Data-Result
no_index:
  directory:
    - t
    - inc
requires:
  Carp: '1.42'
  Data::Dumper: '2.161'
  Modern::Perl: '1.20170117'
  Moo: '2.003002'
  MooX::Types::MooseLike::Base: '0.29'
  Scalar::Util: '0'
  Test::More: '1.302073'
  boolean: '0.46'
  namespace::clean: '0.27'
  overload: '1.28'
version: '1.0003'
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'

Makefile.PL  view on Meta::CPAN

# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
WriteMakefile(
    NAME              => 'Data::Result',
    VERSION_FROM      => 'lib/Data/Result.pm', # finds $VERSION
    LICENSE=>'perl_5',
    PREREQ_PM         => {
    qw(
      Moo  2.003002
      overload 1.28
      Modern::Perl 1.20170117
      MooX::Types::MooseLike::Base 0.29
      Carp 1.42
      namespace::clean 0.27
      Data::Dumper  2.161
      boolean       0.46
      Scalar::Util  0
      Test::More    1.302073
    )
    
    }, # e.g., Module::Name => 1.1

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

package Data::Result;

use Modern::Perl;
use Moo;
use MooX::Types::MooseLike::Base qw(:all);
use Carp qw(croak);
use Scalar::Util qw(blessed);
use boolean;
use namespace::clean;

use overload
  fallback=>1,
  '""'=>sub { $_[0]->msg },

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

;

our $VERSION='1.0003';

=head1 NAME

Data::Result - Handling true and false in a better way!

=head1 SYNOPSIS

  use Modern::Perl;
  use Data::Result;

  # just true 
  my $result=Data::Result->new(is_true=>0);
  if($result) {
    print "Yup its true!\n";
  }

  # True with data
  $result=Data::Result->new(is_true=>1,data=>'Yup This is true!');

lib/Data/Result/Moo.pm  view on Meta::CPAN

package Data::Result::Moo;

use Modern::Perl;
use Data::Result;
use Moo::Role;
use Carp qw(croak);
use namespace::clean;


=head1 NAME

Data::Result::Moo - Data::Result Moo Role

=head1 SYNOPSIS

  use Modern::Perl;
  use Moo;
  with('Data::Result::Moo);

=head1 Description

A simple Moo role wrapper for Data::Result


=head1 OO Methods

t/Data-Result-Moo.t  view on Meta::CPAN

use Modern::Perl;
use Test::More qw(no_plan);
use Data::Dumper;

my $class='Data::Result::Moo';
use_ok($class);
require_ok($class);


my $test=new Test::Moo;
isa_ok($test,'Test::Moo');

t/Data-Result-Moo.t  view on Meta::CPAN


isa_ok($test->new_true,$test->RESULT_CLASS);
ok(!$test->new_false('this is a test'),'should return false');
isa_ok($test->new_false('msg'),$test->RESULT_CLASS);

eval { $test->new_false };
ok($@,'should fail to create a new false objcet without a message');

BEGIN {
  package Test::Moo;
  use Modern::Perl;
  use Moo;
  with('Data::Result::Moo');
  1;
}

done_testing;

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

use Modern::Perl;
use Data::Dumper;
use Test::More qw(no_plan);

my $class='Data::Result';
require_ok($class);
use_ok($class);

eval { $class->new };
ok($@,'should have to failed to construct without is_true');
diag $@;



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