Akopia Akopia Services

[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date ][Minivend by thread ]

[mv] MV4: should [cgi] accept a set= argument?



******    message to minivend-users from "Bill Randle" <billr@exgate.tek.com>     ******


Should one be able to set a cgi variable via the [cgi] tag, as in:
	[cgi name="foo" set="someval"]

analagous to [value]? You can set cgi vars using <input type=hidden>
in HTML or using $CGI->{varname} with mvasp, so it seems like a
reasonable extension to allow it in the tag format.

I looked at the tag_cgi() sub in Interpolate.pm and it would appear,
on the surface, to support this:

    $CGI::values->{$var} = $opt->{set} if defined $opt->{set};
    $value = $CGI::values{$var} || '';

This looks just like the code for tag_value(). However, it doesn't
work. It turns out it can be made to work with two simple patches:

    1. add "cgi" to the list of tags in %addAttr (in Parse.pm) so
       the parser won't gag when it sees the extra "set=" arg.

    2. fix an apparent typo in tag_cgi replacing:
           $CGI::values->{$var}
       with
           $CGI::values{$var}
       (remove the '->')

This seems (with the limited testinmg I've done) to work fine. The big
question is, should this be supported (or is it intended to be supported)
or not?

A diff appears below (against beta2).

	-Bill Randle
	billr@exgate.tek.com

*** Interpolate.pm      Tue Feb 15 22:21:21 2000
--- Interpolate.pm.new  Sat Feb 19 11:13:58 2000
***************
*** 1817,1823 ****
      my($value);

        local($^W) = 0;
!       $CGI::values->{$var} = $opt->{set} if defined $opt->{set};
        $value = $CGI::values{$var} || '';
      if ($value) {
                # Eliminate any MiniVend tags
--- 1817,1823 ----
      my($value);

        local($^W) = 0;
!       $CGI::values{$var} = $opt->{set} if defined $opt->{set};
        $value = $CGI::values{$var} || '';
      if ($value) {
                # Eliminate any MiniVend tags
*** Parse.pm    Tue Feb 15 21:59:16 2000
--- Parse.pm.new        Sat Feb 19 11:15:01 2000
***************
*** 215,220 ****
--- 215,221 ----
                                        area            1
                                        banner          1
                                        catch           1
+                                       cgi             1
                                        data                    1
                                        ecml            1
                                        error           1

-
To unsubscribe from the list, DO NOT REPLY to this message.  Instead, send
email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
Archive of past messages: http://www.minivend.com/minivend/minivend-list


Search for: Match: Format: Sort by: