On Mon, Oct 21, 2013 at 12:20 PM, David Lang <[email protected]> wrote: > On Mon, 21 Oct 2013, Rainer Gerhards wrote: > > On Mon, Oct 21, 2013 at 12:09 PM, David Lang <[email protected]> wrote: >> >> On Mon, 21 Oct 2013, Rainer Gerhards wrote: >>> >>> On Mon, Oct 21, 2013 at 8:52 AM, Rainer Gerhards >>> >>>> <[email protected]>****wrote: >>>> >>>> >>>> On Sun, Oct 20, 2013 at 6:03 PM, Pavel Levshin <[email protected] >>>> >>>>> wrote: >>>>>> >>>>> >>>>> >>>>> I am unable to reproduce this behaviour with global variables. This is >>>>>> what I've tried among others: >>>>>> >>>>>> if $/zz % 3 == 0 or $/zz % 3 == 1 then { >>>>>> set $/zz = $/zz + 1; >>>>>> action(...) >>>>>> } else { >>>>>> set $/zz = 0; >>>>>> action(...) >>>>>> } >>>>>> >>>>>> Could you please explain how is it supposed to work? >>>>>> >>>>>> >>>>>> It's supposed to work just as you describe it. But indeed, it >>>>> doesn't do >>>>> so, I can reproduce the problem. Looks like a regression. Thanks for >>>>> reporting, will now look into it. >>>>> >>>>> >>>>> OK, looks like I stumbled into my own trap. In script, you access >>>> properties via $<propname>. Global variables have the name $/zz (with zz >>>> being the real name). So to access them, you need to access $$/zz. >>>> >>>> I think I got confused about this some time ago, and the doc is also not >>>> correct or at least inconsistent. I now need to work my way through that >>>> mess. Just thought I give you some explanation. >>>> >>>> >>> Ouch, this is going to get ugly since $$var actually ends up giving you a >>> reference to $var not it's value, I believe from prior discussions that >>> the >>> normal variables are $property of $!var!var, >>> >> >> >> That previous discussion was wrong, it is $$!var!var - and it does not >> give >> the ref to $var, but it's value. >> > > hmm, I had a problem where I was trying to set var2 = $$!var1 and then > delete var1 and the result was that once var1 was deleted, var2 had no > value, if var1 wasn't deleted, var2 had a value. when I posted about it, I > was told to change $$ to $ (I'll have to go back and dig up the e-mail for > the exact syntax that I used), and changing to a single $ on the right side > caused everything to work properly after var1 was deleted.
yeah, that's a big confusion that I created, sorry for that. If you look at git logs, you'll even see that there are a couple of regression fixes undoing what an other one did which than got undone... This is what I checked this morning when I remembered that there was something in this area recently. I *think* the bottom problem is that I did not fully obey the $<propname> rule, and after initial review it looks so (and so I did another regression fix that undoes what the previous one did, and I am 98% sure it is right this time). Get to understand with what I mean with "I need a break and the code propbably some refactoring"? Rainer _______________________________________________ rsyslog mailing list http://lists.adiscon.net/mailman/listinfo/rsyslog http://www.rsyslog.com/professional-services/ What's up with rsyslog? Follow https://twitter.com/rgerhards NOTE WELL: This is a PUBLIC mailing list, posts are ARCHIVED by a myriad of sites beyond our control. PLEASE UNSUBSCRIBE and DO NOT POST if you DON'T LIKE THAT.

