in reply to DBI question
You look to be on the right path but not knowing the format of the switchshow command nor the schema of your table, it's a bit difficult. At a high level, you might try something along the lines of:
#!/usr/bin/perl -w use DBI; use Net::Telnet (); $t = new Net::Telnet (Timeout => 10,); $user = "admin"; $passwd = ""; $t->open("Sparta"); $t->login($user, $passwd); @lines = $t->cmd("switchshow"); my $dbh = DBI->connect( ... ); my $sth = $dbh->prepare( q{INSERT INTO table (field_a, field_b) VALUES (?, ?)}); foreach my $line ( @lines ) { #$sth->execute(1, $dbh->quote($line) ); $sth->execute( 1, $line ) } $dbh->commit; $dbh->disconnect;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: DBI question
by runrig (Abbot) on Jun 01, 2005 at 19:46 UTC |