[Boulder.pm] Trickey (for a newbie) String Replacement

Rob Nagler nagler at bivio.biz
Thu May 6 15:37:32 CDT 2004


Peter Hutnick writes:
> What's the non-lazy way to use the functions in a package?

I recommend:

    Foo::Bar->do_it();

Many more modern CPAN packages are written this way.  Older packages
require you to do:

    Foo::Bar::do_it();

It's better than just:

    do_it();

However, many packages (which shall remain nameless) don't make it
easy to find Foo::Bar, because they mix everything up.  To me, all
Foo::Bar functions should be defined in Foo/Bar.pm.  That's the way
bOP is organized, and it makes it very easy to navigate.

> Any idea how to fix the opposite problem of typo warnings when you 
> "reach down into" the module?  (E.g. $Getopt::Std::opt_h)

I'm not sure if you mean this:

use vars qw($Getopt::Std::opt_h);

> Yes, I could not.  I actually don't know the first thing about LaTeX 
> style sheets.  Do they really generate non TeX text output?!

I think you can get them to generate anything in "aux" files.  That's
how bib entries and such work.

> I don't think I was clear.  The two do not share a 1:1 correspondence. 
> Any mapping that I devise could fail with a different input.

Understand.  I thought the dataset was constrained.

> The biggest killer is the fact that TeX lets you make new commands. 
> Guaranteed failure right there.

Well, not really.  TeX commands are macros and easy to interpret, but
we won't got there. ;-)

> So I have settled on a sort of meta-language for describing how /my/ 
> document is best represented in HTML, and s script to implement those rules.

That's great.  I don't think there is a big market in LaTeX to HTML
translators:

http://tex.loria.fr/english/outils.html#latex2html

> A significant portion will be relevant to some other arbitrary LaTeX 
> file, so a few simple changes to the rules file will allow applicability 
> to any other file.

And you'll solve that problem when you come to it.  That's Extreme
Perl at its laziest!

> PS: I am really enjoying and learning from this discussion.

Ditto.

Rob



More information about the Boulder-pm mailing list