[sword-devel] (Perl) Getting list of modules
Joachim Ansorg
sword-devel@crosswire.org
Sat, 28 Jun 2003 23:14:57 +0200
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Christian,
> my Sword.pm has neither ->moduleCount nor ->getModuleAt !? I'm using
> version 1.5.5 of the API. (The Perl module files are at
> www.crosswire.org:/home/sword/ipkgmaker/Sword-1.5.5)
Hm, seems like I added them in CVS after 1.5.5. Wait for 1.5.6 or get CVS :)
> I'd rewrite your code as
>
> # untested
> my $mgr = Sword::SWMgr->new();
>
> @names = map { $mgr->getModuleAt($_)->Name() }
> 1..$mgr->moduleCount();
>
Oh, seems like I'm not good in Perl :)
> sub modules {
> my $self = shift;
>
> return map { $self->getModuleAt($_) } 1..$self->moduleCount();
> }
>
> should do the trick. Now how to add Perl code to the Swig files I
> don't know :).
Swig is based on C I think. I can generate Perl bindings to libraries, but you
can't add Perl functions to the Swig files (which use C/C++ syntax).
We can define own types for the Swig bindings so STL lists and stuff work
better, but that's complicated.
Joachim
- --
<>< Re: deemed!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2-rc1-SuSE (GNU/Linux)
iD8DBQE+/gVVEyRIb2AZBB0RAvIZAJ9R2GsULB3kgk92jRjEm6N1aMclGgCfTFbV
H2Oyicr8H5qlfbkLRJdr6qQ=
=UwKA
-----END PGP SIGNATURE-----