[ic] [read-cookie] question

interchange-users@icdevgroup.org interchange-users@icdevgroup.org
Fri Sep 6 14:31:02 2002


Quoting Dan Browning (dbml@kavod.com):
> At 09:57 AM 9/6/2002 -0700, you wrote:
> >Barry Treahy, Jr. wrote:
> >
> >>The [set-cookie] ITL supports numerous parameters which control the 
> >>definition of the cookie, in particular, the path and domain.  I have 
> >>already set the site to support cookies for the entire domain but I'm 
> >>seeing cookies defined with various path's which I find odd.  My question 
> >>is related to the [read-cookie], however.  Is it safe to presume that the 
> >>read-cookie, since it really has no documented parameters other than the 
> >>cookie name, will return any cookie that matches on the name, regardless 
> >>of the original path? If so, then how do I know which cookie will 
> >>consistently be returned and of not, which is what I would expect, then 
> >>how to I clearly identify which cookie for which path?  Is this simply an 
> >>undocumented parameter?
> >
> >A rudimentary 'Perl' question.  The [set-cookie] document refers to itself 
> >as set-cookie and set_cookie but the Parse.pm only shows set_cookie.  Is 
> >the underscore and hyphen INTERCHANGEable ? :-)
> 
> Yes.  This was a 4.7.x feature addition I believe.

No, not really. ITL tag names have always been either hyphen(-) or
underscore(_), all the way back from Minivend 2.0. It gets canonicalized
when parsed.

Don't mistake that for embedded Perl, where you must always use
underscore; remember that a hyphen can not be in  a valid function call
name, and that hash parameters using hyphens must be quoted.

In other words:

GOOD:  [user-tag  some-param="foo"]
FINE:  [user-tag  some_param="foo"]
OK:    [user_tag  some_param="foo"]
GOOD:  $Tag->user_tag({ some_param => 'foo' });

NONO:  $Tag->user-tag({ some_param => 'foo' }); ## Perl syntax error
NONO:  $Tag->user_tag({ some-param => 'foo' }); ## Option will never be seen

> 
> >If so, which is the better 'style?'
> 
> Personal opinion?  :-)
> 

I like - for ITL tags, both for parms and tags -- it seems easier to read.
Of course in embedded Perl, you have to use _.

-- 
Mike Heins
Perusion -- Expert Interchange Consulting    http://www.perusion.com/
phone +1.513.523.7621      <mike@perusion.com>

People who want to share their religious views with you
almost never want you to share yours with them. -- Dave Barry