So I'm new to Perl along with being new to SQLite. I have SQL experience, but this new Perl syntax is throwing me a bit.
So I have an issue where I'm trying to create a DB from a IPtable log using a Perl script to parse the data that the table has and send notifications out to people. The script also sends notifications to the users, but I don't believe that has anything to do with this problem.
This is the error I'm receiving.
DBD::SQLite::db prepare failed: no such table: syslog_decom_notif at ./send_notification_syslog.pl line 251. Can't call method "execute" on an undefined value at ./send_notification_syslog.pl line 252.
Below is the code where I'm receiving the error from:
2 sub select_contacts {
233 my @contact_info;
234 my $dbh = DBI->connect( DECOM_NOTIFICATION_DB ,"","");
235
236 my ( $where_clause, @exec_params ) = build_where_clause();
237
238 my $SQL = <<SQL;
239 select
240 contact
241 , status
242 , contact_mngr
243 , hostname
244 , contact_type
245 , syslog_server
246 from
247 syslog_decom_notif
248 $where_clause
249 SQL
250 debug ( __LINE__ . " Excuting SQL = \n[ $SQL ]\n" );
251 my $sth = $dbh->prepare( $SQL );
252 $sth->execute( @exec_params );
253 if ( $debug_mode ) {
254 my @cols = @{$sth->{NAME}};
255 print join '|', @cols;
256 print "\n";
257 }
258 while (my @res = $sth->fetchrow) {
259 for ( my $i=0; $i<@res; $i++ ) { $res[$i] = 'Null' if ! defined $res[$i]; }
260 my $row = join '|', @res;
261 debug "$row\n";
262 push @contact_info, $row;
263 }
264 $sth->finish();
265 return @contact_info;
266 }
I've searched around and I can't seem to find anything that could really help with this problem.
I appreciate any and all ideas.
Best Regards
no such table: syslog_decom_notif. Is there such a table? Try executing the query ($SQL, you're already outputting it) in a command line db client. Also it says you're creating a table and storing data, but your code only shows aSELECTstatement. That's a bit odd. ;-)