First of all, thank you to Risto and David for answering a lot of my questions... it's helped a lot and I'm making a lot of progress.
Right now, I'm trying to figure out how to integrate a database with SEC. Specifically, I want to use SQLite3 with an in-memory database to store data temporarily and query it while SEC is running. I'm using SEC_INTERNAL_EVENT to do the setup: type=Single ptype=Substr pattern=SEC_STARTUP context=[SEC_INTERNAL_EVENT] continue=TakeNext desc=setup stuff up when SEC starts action= eval %o ( use DBI; ) type=Single ptype=Substr pattern=SEC_STARTUP context=[SEC_INTERNAL_EVENT] continue=TakeNext desc=setup in-memory database connection action= lcall %dbh -> ( sub{ \ my $dbh = DBI->connect("dbi:SQLite:dbname=:memory","","") or die($DBI::errstr); \ return $dbh; \ } ); \ if %dbh ( \ logonly INFO: connected to in-memory sqlite3 database. \ ); \ lcall %ret %dbh -> ( sub{ \ my $dbh = $_[0]; \ $db_backup = '/var/lib/sec/event_cache.db'; \ if( -f $db_backup ){ \ $dbh->sqlite_backup_from_file($db_backup); \ return 2; \ } \ my $sql = qq(CREATE TABLE events ( \ id integer primary key autoincrement, \ timestamp float, \ type text \ );); \ my $ret = $dbh->do($sql); \ if( $ret < 0 ){ return 0; } \ return 1; \ } ); \ When I run my code, I get this runtime error: Calling code 'CODE(0x1b73580)' and setting variable '%dbh' Variable '%dbh' set to 'DBI::db=HASH(0x24e7fd0)' INFO: connected to in-memory sqlite3 database. Calling code 'CODE(0x20bcfe8)' and setting variable '%ret' Code 'CODE(0x20bcfe8)' runtime error: Can't locate object method "do" via package "DBI::db=HASH(0x24e7fd0)" (perhaps you forgot to load "DBI::db=HASH(0x24e7fd0)"?) at (eval 10) line 1. I'm not sure why this is failing, but my guess is that I can't pass the database object handle via the %dbh action variable. Any ideas on how to accomplish this? What's the best way to setup to pass around data structure that all the rules can see when using perl mini-programs (via lcall or eval)? BTW, I've seen the example here (http://simple-evcorr.sourceforge.net/SEC-tutorial/article-part2.html#DATABASEINTEGRATION), but I would prefer not having a separate process to handle the database. Thanks, Bond ------------------------------------------------------------------------------ _______________________________________________ Simple-evcorr-users mailing list Simple-evcorr-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/simple-evcorr-users