[ic] AddAttr only UserTags sometimes work, sometimes fail

Mike Heins mike at perusion.com
Tue Apr 20 16:34:40 UTC 2010


Quoting Chris Keane (chris.keane at zzgi.com):
> 
> Hi all,
> 
> IC 5.7.2, perl 5.10.0
> 
> I'm having a weird issue with some UserTags that have all attributes 
> passed to them via AddAttr, for example:
> 
> UserTag demotag AddAttr
> userTag demotag Routine <<EOR
> sub
> {
>     my ($opt) = @_;
> ...
> 
> 
> 
> The problem comes when accessing any of the members of the $opt hashref. 
> For the sake of example, let's say that we have an argument to the 
> UserTag called "thing", so the call would be
> [demotag thing=thing_content]
> 
> Not all time, but SOMETIMES when I try to access some of the data, even 
> very simply, for example
> 
> ::logError("opt thing is ". $opt->{thing});
> 
> the tag fails and an error is written to the global error.log:
> demo.html Died in server spawn: Can't use string ("thing_content") as a 
> HASH ref while "strict refs" in use at (tag 'cgi') line 17.
> 
> This worked as expected in previous version of IC, and I suspect in 
> later versions (for example, I haven't seen this problem come up on a 
> 5.7.4 server, not that it won't, just haven't seen it).
> 
> The weird part is that sometimes it works as I would expect. Then it 
> will fail and consistently fail for some random period of time. Then it 
> will work again.
> 
> I can work around the problem by providing an Order to the usertag:
> UserTag demotag Order x
> UserTag demotag AddAttr
> userTag demotag Routine <<EOR
> sub
> {
>     my ($x,$opt) = @_;
> 
> Any thoughts or guidance?

Are these calls from $Tag objects or via ITL parse? I am guessing 
ITL parse. If we don't pass any argument at all to the routine, I am
guessing that @_ could have some residual value causing the problem.

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

In character, in manners, in style, in all things, the supreme excellence
is simplicity. -- Longfellow



More information about the interchange-users mailing list