[ic] Setting multiple scratch in one tag

Paul Jordan paul at gishnetwork.com
Wed Jul 5 14:50:55 EDT 2006

interchange-users-bounces at icdevgroup.org wrote:
> On Sat, 24 Jun 2006 10:08:07 -0700
> "Paul Jordan" <paul at gishnetwork.com> 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)   ).

Thanks Davor

I guess I didn't say it but as this would work, I was looking for something
like the [import] tag for its cleanliness and speed WRT readability and ITL
interpolation. At this point I do try to perlize everything I can, but in my
ametureness I still do sometimes appreciate the readability of things. I
rarely use the [import] tag and opt for dbi or [query] but it is still a
very beautiful tag, none the less.

With a hack as Jon suggested I could setup at the top of every page and see
exactly what the page is and can do, like reading a book - almost like a
mini documentation of the page.

Your suggestion is good though, and I'll no doubt put it to use :-)

Paul Jordan

More information about the interchange-users mailing list