Interchange Documentation, was: Re: [ic] Perl / Session question

Peter peter at pajamian.dhs.org
Thu Apr 15 19:25:55 EDT 2004


This may be what the documentation wiki does, I don't know for sure 
because it was broken when I tried it (got the message, "We're sorry, 
the Interchange server is unavailable...").

Anyways, what about allowing users to add comments to the end of each 
documentation page.  Postgresql does this and it seems to work well. 
Then every once in a while someone can go through and pick out relevent 
bits to add to the documentation on the page then clear out the 
comments.  This allows everyone to contribute to the documentation and 
makes it easy enough so that people are willing to do it.

Peter

interchange at thedesignpeople.com wrote:
> Stefan Hornburg wrote:
> 
>> On Wed, 14 Apr 2004 17:42:58 -0700
>> "interchange at thedesignpeople.com" <interchange at thedesignpeople.com> 
>> wrote:
>>
>>
>>> Could someone knowledgable in perl be kind enough to help me out here.
>>>
>>> I have discovered that this works to manually set the discount:
>>>   $Session->{discount} = ({
>>>                     'code1' => '199',
>>>                     'code2' => '199',
>>>                     'code3' => '199'
>>>             });
>>>
>>> I thought the following would have the same effect but does not work:
>>> # create empty array
>>> @arrayval = ();
>>> # create a hash
>>> $hashval = {
>>>           'code1' => '199',
>>>           'code2' => '199',
>>>           'code3' => '199'
>>>           };
>>> # put the hash into an array
>>> push @arrayval, $hashval;
>>>
>>> $Session->{discount} = @arrayval;
>>>
>>> The script dies with the following error:
>>> Runtime error: Can't use string ("1") as a HASH ref while "strict 
>>> refs" in use at 
>>> /www/interchange/interchange-5/lib/Vend/Interpolate.pm line 5151.
>>>
>>> I'm not sure what this error means.
>>> Can someone please explain what I'm doing wrong?
>>
>>
>>
>> $Session->{discount} = $hashval;
>>
>> Although doing tricks like that are not for the unwary and may break
>> on later versions of Interchange.
>>
> 
> Is this because the datastructure for holding the discounts may change 
> or for security reasons (e.g. potential for an oursider to set their own 
> discount methods) or both?  I was trying to figure out a dynamic and 
> easy way to apply a discount to a large number of items without having 
> to resort to manually inputing the
> [discount sku]%s-10[/discount]
> for each sku.
> 
> What I am doing is putting all the skus in a scratch varaible named for 
> the particular discount code.
> 
> Then I set another scratch variable for the code that the visitor inputs.
> 
> In perl i read the skus corresponding to discount code entered and set 
> the $Session->{discount} to the appropriate value.
> 
> I can visualize this working with a database table instead of a scratch 
> variable to hold the discounts and skus as well.
> 
> I realize if the discount mechanism ever changes it will need to change 
> my code, but since I currently don't see another way to do this (except 
> for the manual mehtod), i'm kinda stuck.
> 
> Regards,
> Mike Kang
> 
> _______________________________________________
> interchange-users mailing list
> interchange-users at icdevgroup.org
> http://www.icdevgroup.org/mailman/listinfo/interchange-users
> 


More information about the interchange-users mailing list