texinfo-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

texi-elements-by-size as example


From: Karl Berry
Subject: texi-elements-by-size as example
Date: Mon, 16 Apr 2012 08:59:33 -0700

Hi Patrice,

    Date: Fri, 17 Feb 2012 19:12:51 +0100
    To: address@hidden

    [...]
    That was not really my point, my point is that the 
      texi_sort_elements_count.pl
    script could be used as a starting point for any command line program
    written in perl that interfaces with the parser, 

Ok, that sounds good.  In that case, I think a bit more work is needed
to make it serve the purpose.  As an example program, it shouldn't
require the configure from texinfo (as in the @datadir@/@PACKAGE@
stuff).  And in general, it requires that Texinfo/Parser.pm and the
dependent libraries like Unidecode.pm be in an installed Texinfo tree,
which seems unnecessarily restrictive to me.  For example, I cannot run
it myself. :)

It would be useful for it to be able to be find the libraries either
within the Texinfo development sources, or in any arbitrary directory
where Texinfo/TP has been installed.  

The directory containing Texinfo/Parser.pm is simple to include in @INC,
whether computed inside the program or by perl -I or whatever.  The main
problem is finding the non-Texinfo libraries which the Parser wants to
read: currently Locale::Messages, Unicode::EastAsianWidth, and
Text::Unidecode.

That list may change.  Besides that, we surely don't want to duplicate
the complex logic from texi2any.pl for finding them in any program that
wants to use TP.  I'm not sure if it will work, and maybe you will have
a better idea, but here's my initial thought -- what if we provide an
interface that would be used from BEGIN, something like this:

BEGIN {
  my $texinfolibdir = "../tp"; # just for testing, obviously needs generalizing
  unshift @INC, ($texinfolibdir);
  #
  require Texinfo::Init;
  Texinfo::Init::init();  # load the needed libraries
}

use Texinfo::Parser;
..

wdyt?

Ideally texi2any.pl could use the same code, to avoid duplication, but
I'm not sure if that would be possible.

I committed a slightly-modified script util/texi-elements-by-size to
along these lines, for possible convenience.

Thanks,
karl



reply via email to

[Prev in Thread] Current Thread [Next in Thread]