[interchange: 4/4] NAME
Mike Heins <[email protected]>
| Newsgroups | gmane.comp.web.interchange.cvs |
|---|---|
| Message-ID | <[email protected]> |
commit 71224d2808601341c3d9c78778eba781ced2b082 Author: Mike Heins <[email protected]> Date: Sat Mar 22 09:53:25 2014 -0400 NAME tv -- true temporary, non-session set/value tag SYNOPSIS [ts foo]The time is: [time fmt="%H:%M"][/ts] [tv foo] (Shows "The time is: 09:10") [tn bar]The time tag is set as in: [time fmt='%H:%M'][/tn] [tv bar] (Shows "The time tag is set as in: [time fmt='%H:%M']") DESCRIPTION Interchange uses "[tmp foo][/tmp]" and "[tmpn bar][/tmpn]" to set temporary scratch values. While this works OK in most cases, these values have to be managed in the session, and also may overwrite values which could be counted on by other pages (when set with "[set ...]") or by manipulating $Scratch. The above three tags replace this scheme with values that are based in the $Vend::Interpolate::Tmp space. These values are available in embedded Perl with $Tmp, so are usable in the same fashion as $Scratch. But they are truly temporary and will never be saved to a session. [ts VARNAME]VALUE[/ts] ITL code in VALUE *is* interoplated prior to setting VARNAME in $Tmp. [tn VARNAME]VALUE[/tn] ITL code in VALUE is *not* interoplated prior to setting VARNAME in $Tmp. [tv VARNAME] Display value of VARNAME. AUTHOR Mike Heins, <[email protected]> BUGS The usual number. code/SystemTag/tv.coretag | 88 +++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 88 insertions(+), 0 deletions(-) --- diff --git a/code/SystemTag/tv.coretag b/code/SystemTag/tv.coretag new file mode 100644 index 0000000..ef32b4e --- /dev/null +++ b/code/SystemTag/tv.coretag @@ -0,0 +1,88 @@ +UserTag tv Order name +UserTag tv Description Return $Tmp value +UserTag tv Routine <<EOR +sub { + my $key = shift; + my $val = $Vend::Interpolate::Tmp->{ $key }; + return $val; +} +EOR + +UserTag ts Order name +UserTag ts hasEndTag +UserTag ts Interpolate +UserTag ts Description Set $Tmp value +UserTag ts Routine <<EOR +sub { + my $key = shift; + $Vend::Interpolate::Tmp->{$key} = shift; + return ''; +} +EOR + +UserTag tn Order name +UserTag tn hasEndTag +UserTag tn Description Set $Tmp value +UserTag tn Routine <<EOR +sub { + my $key = shift; + $Vend::Interpolate::Tmp->{$key} = shift; + return ''; +} +EOR + +UserTag tv Documentation <<EOD +=head1 NAME + +tv -- true temporary, non-session set/value tag + +=head1 SYNOPSIS + + [ts foo]The time is: [time fmt="%H:%M"][/ts] + [tv foo] + (Shows "The time is: 09:10") + + [tn bar]The time tag is set as in: [time fmt='%H:%M'][/tn] + [tv bar] + (Shows "The time tag is set as in: [time fmt='%H:%M']") + +=head1 DESCRIPTION + +Interchange uses C<[tmp foo][/tmp]> and C<[tmpn bar][/tmpn]> to set +temporary scratch values. While this works OK in most cases, these +values have to be managed in the session, and also may overwrite values +which could be counted on by other pages (when set with C<[set ...]>) or by +manipulating $Scratch. + +The above three tags replace this scheme with values that are based +in the C<$Vend::Interpolate::Tmp> space. These values are available +in embedded Perl with C<$Tmp>, so are usable in the same fashion as +C<$Scratch>. But they are truly temporary and will never be saved to +a session. + +=over 4 + +=item [ts VARNAME]VALUE[/ts] + +ITL code in VALUE I<is> interoplated prior to setting VARNAME in $Tmp. + +=item [tn VARNAME]VALUE[/tn] + +ITL code in VALUE is I<not> interoplated prior to setting VARNAME in $Tmp. + +=item [tv VARNAME] + +Display value of VARNAME. + +=back + +=head1 AUTHOR + +Mike Heins, <[email protected]> + +=head1 BUGS + +The usual number. + +=cut +EOD