[vhffs-dev] [1397] Get rid of "unless", using hash merges

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Revision: 1397
Author:   beuss
Date:     2009-05-17 00:22:09 +0200 (Sun, 17 May 2009)

Log Message:
-----------
Get rid of "unless", using hash merges

Modified Paths:
--------------
    branches/vhffs-design/vhffs-api/src/Vhffs/Panel/Public.pm


Modified: branches/vhffs-design/vhffs-api/src/Vhffs/Panel/Public.pm
===================================================================
--- branches/vhffs-design/vhffs-api/src/Vhffs/Panel/Public.pm	2009-05-03 17:49:51 UTC (rev 1396)
+++ branches/vhffs-design/vhffs-api/src/Vhffs/Panel/Public.pm	2009-05-16 22:22:09 UTC (rev 1397)
@@ -82,15 +82,19 @@
 	
 	$vars = {} unless(defined $vars);
 	
-	$vars->{theme} = $conf->get_panel->{default_theme} unless(defined $vars->{theme});
-	$vars->{left} = 'parts/left-menu.tt' unless(defined $vars->{left});
-	$vars->{right} = 'parts/tags-cloud.tt' unless(defined $vars->{right});
-	$vars->{top} = 'parts/top-menu.tt' unless(defined $vars->{top});
-	$vars->{panel_url} = $conf->get_panel->{url};
-	$vars->{help_url} = $conf->get_panel->{url_help};
-	$vars->{users_avatar} = Vhffs::Functions::strtobool( $conf->get_panel->{'users_avatars'} );
-	$vars->{groups_avatar} = Vhffs::Functions::strtobool( $conf->get_panel->{'groups_avatars'} );
+	my $default_vars = {
+		theme => $conf->get_panel->{default_theme},
+		left => 'parts/left-menu.tt',
+		right => 'parts/tags-cloud.tt',
+		top => 'parts/top-menu.tt',
+		panel_url => $conf->get_panel->{url},
+		help_url => $conf->get_panel->{url_help},
+		users_avatar => Vhffs::Functions::strtobool( $conf->get_panel->{'users_avatars'} ),
+		groups_avatar => Vhffs::Functions::strtobool( $conf->get_panel->{'groups_avatars'} )
+	};
 	
+	$vars = {%$default_vars, %$vars};
+
 	# Handling ajax stuff
 	if($self->{is_ajax_request}) {
 		


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/