Skip to content

Instantly share code, notes, and snippets.

@banthar
Created May 6, 2010 17:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save banthar/392445 to your computer and use it in GitHub Desktop.
Save banthar/392445 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
use DBI;
use LWP::Simple;
my $dbh = DBI->connect("dbi:SQLite:dbname=servers.sqlite3","","");
{
my $sth = $dbh->prepare("CREATE TABLE servertypes (name varchar(255));");
if(defined $sth)
{
$sth->execute();
}
}
my @hosts=("http://google.com","http://reddit.com","http://digg.com");
foreach( @hosts)
{
my $host=$_;
print "Checking $host ...\n";
my $type=head($host)->server."\n";
my $sth=$dbh->prepare("INSERT INTO servertypes VALUES ('$type');");
$sth->execute();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment