I have upgraded the interface with the ability to list books, chapters,
verses, and the ability to search. Pretty much everything you need is
in here now. Time to make a nice CGI interface! Should be a cinch with
this.
I would love comments on the interface, if people can think of ways to
do it better. One thing I'm planning on is having each module detect
which books it actually has installed by checking to see if the first
verse of the book exists or not. Some modules like ISV don't have
everything.
Interface attached. Pound away!
INSTALLATION
------------
1. tar xzvf Sword-0.02.tar.gz
2. cd Sword-0.02
3. perl Makefile.PL
4. make
5. make install
USAGE
-----
OK, now you can go through the Bible with the interface three ways:
1. go directly to verses by name and then step through the Bible up and
down
This prints out everything from I John 2:3 to the end of the Bible:
use Sword;
my $mod = new Sword::Module("KJV");
my $vi = $mod->get_iterator("I John 2:3");
do {
print $vi->get_key(), " : ", $vi->get_verse(), "\n";
} while($vi->next());
# $vi->prev() would go to the beginning of the Bible backwards
2. Browse by book, chapter and verse
This prints out the first verse of every book in the Bible:
use Sword;
my $mod = new Sword::Module("KJV");
my $vi = $mod->get_iterator();
foreach my $book ($mod->get_books()) {
$vi->set_book($book);
$vi->set_chapter_num(1);
$vi->set_verse_num(1);
print $vi->get_key(), " : ", $vi->get_verse(), "\n";
# You can use get_book, get_chapter_num
}
3. Search for verses
And of course you can search! This gets everything in the KJV with the
word "sword" in it:
use Sword;
my $mod = new Sword::Module("KJV");
foreach my $result ($mod->search("sword")) {
print "$result->[0] : $result->[1]\n";
}
--John Keiser
Sword-0.02.tar.gz