2017-08-04 15:15 GMT+03:00 Stuart Kendrick <stua...@alleninstitute.org>:

> I want a mental model for how to sec identifies variables in a config file.
>
>
>
> Here for example, I want to save some typing in my rules by creating a
> variable containing a string.  In this example, I spend a lot of time (in
> the rules) writing to a particular file, so I want to type “action=write
> $tocpipe whatever” rather than “action=write /home/tocops/.tocpipe whatever”
>
>
>
> # Global variables for config file
>
> type=Single
>
> ptype=SubStr
>
> pattern=SEC_STARTUP
>
> context=SEC_INTERNAL_EVENT
>
> desc=initialize location of tocpipe
>
> action=assign $tocpipe /home/tocops/.tocpipe
>
> action=assign %tocpipe /home/tocops/.tocpipe
>
>
>
> Thinking in Perl, I would call this variable ‘$tocpipe’.  But sec doesn’t
> like me to doing that; instead, it seems happier if I name the variable
> ‘%tocpipe’, i.e. with a leading percent sign rather than a leading dollar
> sign.
>
>
>
> Am I correctly understanding here that while Perl may want to see a ‘$’ in
> front of simple variables, sec (in its config files) wants to see a ‘%’?
>
>
>

That's correct -- SEC action list variables are always preceded by %-sign.
Historically, $-sign has been used in front of match variables which
represent data extracted during pattern matching. Having another prefix for
action list variables makes a clear distinction between two types of
variables.


> I keep wanting to think about ‘%tocpipe’ as a Perl does … as a hash … and
> I’m beginning to believe that I’m mistaken in this thinking.
>
>
>
> Would you agree with this statement?
>
>    - Inside config files, sec uses the sigil ‘%’ to indicate a variable.
>    This is a simple variable, not a Perl hash.Action
>
>
Action list variables have never been Perl hashes and it is evident from
SEC documentation, especially when you read more about builtin action list
variables:
http://simple-evcorr.github.io/man.html#lbAI
For example. the %.year variable holds a number that corresponds to current
year (e.g., today its value is 2017), while %.chr12 holds the form feed
character (ASCII 12).
When you set your own action list variables, it is not possible to store
any hash-like structures into them, and every value is stored as a string.

Hope this helps,
risto


>    -
>
>
>
> --sk
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Simple-evcorr-users mailing list
> Simple-evcorr-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/simple-evcorr-users
>
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Simple-evcorr-users mailing list
Simple-evcorr-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/simple-evcorr-users

Reply via email to