This is an automated email from the git hooks/post-receive script.

intrigeri pushed a commit to annotated tag 0.19
in repository libtest-bdd-cucumber-perl.

commit 106afaef6fdab1b7a003feb18e5da336a159f16d
Author: Ben Rogers <b...@bdr.org>
Date:   Thu Dec 5 11:22:17 2013 +0000

    Fix for issue #22
---
 lib/Test/BDD/Cucumber/StepContext.pm | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/lib/Test/BDD/Cucumber/StepContext.pm 
b/lib/Test/BDD/Cucumber/StepContext.pm
index b4e52ad..7ad5563 100644
--- a/lib/Test/BDD/Cucumber/StepContext.pm
+++ b/lib/Test/BDD/Cucumber/StepContext.pm
@@ -184,13 +184,24 @@ sub transform
     TRANSFORM:
     for my $transformer ( @{ $self->transformers } )
     {
+        # turn off this warning so undef can be set in the following regex
+        no warnings 'uninitialized';
+
         # uses the same magic as other steps
         # and puts any matches into $1, $2, etc.
         # and calls the Transform step
-        if ( $value =~ s/$transformer->[0]/$transformer->[1]->( $self )/e )
+
+        # also, if the transformer code ref returns undef, this will be coerced
+        # into an empty string, so need to mark it as something else
+        # and then turn it into proper undef
+
+        if ( $value =~ s/$transformer->[0]/
+                my $value = $transformer->[1]->( $self );
+                defined $value ? $value : '__UNDEF__'
+            /e )
         {
             # if we matched then stop processing this match
-            return $value;
+            return $value eq '__UNDEF__' ? undef : $value
         }
     }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libtest-bdd-cucumber-perl.git

_______________________________________________
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits

Reply via email to