[libcatmandu-perl] 26/85: Maybe just/nothing/value is nothing methods available for external programs

Jonas Smedegaard dr at jones.dk
Tue May 20 09:56:16 UTC 2014


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

js pushed a commit to tag 0.91
in repository libcatmandu-perl.

commit 30a4d8fd03d39f91ff9300802d546a1cef273547
Author: Patrick Hochstenbach <patrick.hochstenbach at ugent.be>
Date:   Sun May 11 21:01:00 2014 +0200

    Maybe just/nothing/value is nothing methods available for external
    programs
---
 lib/Catmandu/Fix/Bind/maybe.pm | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/lib/Catmandu/Fix/Bind/maybe.pm b/lib/Catmandu/Fix/Bind/maybe.pm
index 92173a7..2590287 100644
--- a/lib/Catmandu/Fix/Bind/maybe.pm
+++ b/lib/Catmandu/Fix/Bind/maybe.pm
@@ -17,13 +17,18 @@ sub nothing {
 	bless \(my $d = undef), __PACKAGE__;
 }
 
-sub is_nothing { reftype $_[0] ne 'ARRAY'  }
+sub is_nothing { 
+	my ($self,$mvar) = @_;
+	reftype $mvar ne 'ARRAY'  
+}
 
 sub value {
-    if (is_nothing($_[0])) {
+	my ($self,$mvar) = @_;
+
+    if ($self->is_nothing($mvar)) {
         {};
     } else {
-        $_[0]->[0];
+        $mvar->[0];
     }
 }
 # ---
@@ -36,16 +41,16 @@ sub unit {
 sub bind {
 	my ($self,$mvar,$func) = @_;
 
-	if (is_nothing($mvar)) {
+	if ($self->is_nothing($mvar)) {
 		return $self->nothing;
 	}
 
 	my $res;
 
 	eval { 
-
-		$res = $func->(value($mvar))
+		$res = $func->($self->value($mvar));
 	};
+
 	if ($@ && ref $@ eq 'Catmandu::Fix::Reject') {
 		die $@;
 	}

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



More information about the Pkg-perl-cvs-commits mailing list