[libbread-board-perl] 51/66: Simplify the container sugar further

Jonas Smedegaard js at alioth.debian.org
Sun Sep 29 21:23:39 UTC 2013


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

js pushed a commit to branch master
in repository libbread-board-perl.

commit e6f5390898c9653bc99c543e78c44b44ba27707a
Author: Florian Ragwitz <rafl at debian.org>
Date:   Wed Aug 28 13:52:12 2013 -0400

    Simplify the container sugar further
    
    There was only one place branching on $name_is_obj left, so we might as well get
    rid of the temporary.
---
 lib/Bread/Board.pm |   17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/lib/Bread/Board.pm b/lib/Bread/Board.pm
index 6a28f05..f8441ac 100644
--- a/lib/Bread/Board.pm
+++ b/lib/Bread/Board.pm
@@ -46,27 +46,24 @@ sub set_root_container {
 sub container ($;$$) {
     my $name = shift;
 
-    my $name_is_obj = 0;
-    if (blessed $name){
+    my $c;
+    if (blessed $name) {
         confess 'an object used as a container must inherit from Bread::Board::Container or Bread::Board::Container::Parameterized'
             unless $name->isa('Bread::Board::Container') || $name->isa('Bread::Board::Container::Parameterized');
-        $name_is_obj = 1;
-    }
-
-    my $is_inheriting = !$name_is_obj && $name =~ s/^\+//;
-    confess "Inheriting containers isn't possible outside of the context of a container"
-        if $is_inheriting && !defined $CC;
 
-    my $c;
-    if ($name_is_obj) {
         confess 'container($object, ...) is not supported for parameterized containers'
             if scalar @_ > 1;
+
         # this is basically:
         # container( A::Bread::Board::Container->new, ... )
         # or someone using &container as a constructor
         $c = $name;
     }
     else {
+        my $is_inheriting = $name =~ s/^\+//;
+        confess "Inheriting containers isn't possible outside of the context of a container"
+            if $is_inheriting && !defined $CC;
+
         # if we have more than 1 argument, then we are a parameterized
         # container, so we need to act accordingly
         if (scalar @_ > 1) {

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



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