Skip to content

Commit

Permalink
Merge pull request mateu#1 from arcanez/master
Browse files Browse the repository at this point in the history
remove DDC and extraneous refs
  • Loading branch information
mateu committed Nov 30, 2011
2 parents 1e4114a + 7fd7c34 commit ccf9963
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/MooX/Types/MooseLike.pm
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,16 @@ my @tests = map { 'is_' . $_ } @types;
our @EXPORT_OK = (@types, @tests);
our %EXPORT_TAGS = ( 'all' => \@EXPORT_OK );

use Data::Dumper::Concise;
foreach my $type (keys %{types}) {
next unless (defined $types{$type}->{message});

my $assertion = 'assert_' . $type;
my $name = __PACKAGE__ . '::' . $assertion;
my $msg; $$msg = $types{$type}->{message};
my $test; $$test = $types{$type}->{test};
my $msg = $types{$type}->{message};
my $test = $types{$type}->{test};

quote_sub $name => q{
die $$msg->(@_) if not $$test->(@_);
die $msg->(@_) if not $test->(@_);
}, { '$msg' => \$msg, '$test' => \$test };

{
Expand All @@ -125,7 +124,7 @@ foreach my $type (keys %{types}) {
*$is_type = sub {
die "Exception: ${is_type}() can only take one argument.\nSuggestion: Maybe you want to pass a reference?\n"
if defined $_[1];
$$test->($_[0]);
$test->($_[0]);
}
}
}
Expand Down

0 comments on commit ccf9963

Please sign in to comment.