[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ic] Setting multiple scratch in one tag


On Sat, 24 Jun 2006 10:08:07 -0700
"Paul Jordan" <suppressed> wrote:

> I was
> wondering, would there be any efficiency gain to have a tag made that did
> something like the following:
> 
> [tmp list=1]
> 	page_title: Home
> 	seetab: home
> 	subtab_a: 1
> 	foo: [sql-param bar]
> [/tmp] 
> 
> I imagine that it only needs to call ?something? once to set all four, yes?
> I am mainly thinking of the typing speed, readability and maintenance of
> these things, as well as any execution gains.

Hey Paul,

why not something like:

[calc]
	my %set = (
		key1 => 'val1',
		key2 => 'val2',
		key3 => 'val3',
	);

	while (my ($k,$v) = each %set) { $Tag->tmp($k, $v) }
[/calc]


Too bad this can't be shorten even further. The 'each' iterator
only accepts an already existing hash (can't use (k1=>v1) or %{ k1=>v1 }
in place of %set), and it's also not possible to use the shorter form
in 'while' (   $Tag->tmp($k, $v) while (my ($k,$v) = each %set)   ).

_______________________________________________
interchange-users mailing list
suppressed
http://www.icdevgroup.org/mailman/listinfo/interchange-users


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.