Pedro,
you need to use two percent-signs (%%) in front of main::context_list.
This rule used to work with earlier SEC version only because the 2.4
version left unset action list variables intact. Note that since there
is % in front of main::, and variable substitution is carried out inside
Perl miniprograms, %main is regarded as an action list variable. Since
this variable is unset, SEC-2.4 didn't carry out any evaluation for it.
However, since the 2.6 version unset variables are replaced with empty
strings (like UNIX shells and most scripting languages do). Note that
leaving Perl hashes unescaped inside Perl miniprograms is quite
dangerous in the 2.4 version as well -- just imagine that one adds new
rules to a large rule base, and one of these added rules creates an
action list variable %main...
kind regards,
risto
On 08/22/2011 06:10 PM, Pedro Rafael Alves Simoes wrote:
> Hello,
>
> I'm using sec 2.6.0 and when in my rules file I try to store/restore
> the contexts, the %main variable isn't recognized:
>
> SEC (Simple Event Correlator) 2.6.0
> Reading configuration from cpuavg.sec
> 5 rules loaded from cpuavg.sec
> Stdin connected to terminal, SIGINT can't be used for changing the logging
> level
> Creating SEC internal context 'SEC_INTERNAL_EVENT'
> Creating SEC internal event 'SEC_STARTUP'
> Evaluating code 'use Storable; ::context_list =
> %{retrieve("/home/psimoes/contexts/cpuavg.dump")} if -e
> "/home/psimoes/contexts/cpuavg.dump"; ' and setting variable '%a'
> Error evaluating code 'use Storable; ::context_list =
> %{retrieve("/home/psimoes/contexts/cpuavg.dump")} if -e
> "/home/psimoes/contexts/cpuavg.dump"; ': Can't modify constant item in
> scalar assignment at (eval 7) line 1, near "} if"
> Deleting SEC internal context 'SEC_INTERNAL_EVENT'
>
>
> Here's the code:
> # Restore contexts
> type=Single
> ptype=RegExp
> pattern=(SEC_STARTUP|SEC_RESTART)
> context=SEC_INTERNAL_EVENT
> desc=Restore contexts
> action=eval %a ( use Storable; %main::context_list =
> %{retrieve("/home/psimoes/contexts/cpuavg.dump")} if -e
> "/home/psimoes/contexts/cpuavg.dump"; );
>
> # Store contexts
> type=Single
> ptype=SubStr
> pattern=SEC_SHUTDOWN
> context=SEC_INTERNAL_EVENT
> desc=Saving the SEC contexts
> action=eval %a ( store(\%main::context_list,
> "/home/psimoes/contexts/cpuavg.dump") );
>
> This code works in sec 2.4.1.
>
> Any help?
>
> ------------------------------------------------------------------------------
> uberSVN's rich system and user administration capabilities and model
> configuration take the hassle out of deploying and managing Subversion and
> the tools developers use with it. Learn more about uberSVN and get a free
> download at: http://p.sf.net/sfu/wandisco-dev2dev
> _______________________________________________
> Simple-evcorr-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/simple-evcorr-users
>
------------------------------------------------------------------------------
uberSVN's rich system and user administration capabilities and model
configuration take the hassle out of deploying and managing Subversion and
the tools developers use with it. Learn more about uberSVN and get a free
download at: http://p.sf.net/sfu/wandisco-dev2dev
_______________________________________________
Simple-evcorr-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/simple-evcorr-users