[sword-devel] Feature Complete Perl Interface

John Keiser sword-devel@crosswire.org
21 Jul 2001 08:42:37 -0400


I'll take a look ... right now I'm implementing a new parse_verse_list() in Perl
(the Sword one doesn't seem to actually support ranges, even though there's
an option for it).

How does language stuff work?  Can you just say
systemLocaleMgr.setDefaultLocaleName(...) and then book names and verses
and everything will automagically come back in the new language?
Specifically, will the book[] array in VerseKey work correctly?

--John

On 20 Jul 2001 21:22:00 +0200, Joachim Ansorg wrote:
> Hi!
> 
> This is really cool!
> I'll probably create a small script with it to send a SMS with the daily 
> watchwords to a friend of mine. I think it will be really simple!
> 
> A thing I'm thinking about is a possibility to set the language of the 
> booknames (e.g. German).
> The functions in Sword to do this are in SWMgr. Is it possible that you 
> implement it? It would be cool because foreigners do not understand english 
> booknames often.
> 
> 
> Thank you for your work!
> Joachim
> 
> > 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
> 
> ----------------------------------------
> Content-Type: application/x-gzip; name="Anhang: 1"
> Content-Transfer-Encoding: base64
> Content-Description: 
> ----------------------------------------
>