dragonchild has asked for the wisdom of the Perl Monks concerning the following question:

Definitions:

I first asked this question here, without really knowing what I was asking. Now, I have a much better idea of what I'm trying to do.

However, I'm not sure if CPAN has a ready-made solution. I don't think I want a markup-language or template. In fact, I don't think I want any hard-coded values in these layouts at all.

What I want to be able to to do is create one layout for a given report. Then, with:

  1. The layout
  2. A format to display it in
  3. The data to be displayed
I can display it. The reason I think I want to separate layout from format is that PDF requires more info that HTML (i.e., pagebreaks). So, instead of worrying about PDF not having its info, instead put as much info as I can into the layout and translators use what they want. So, HTML can ignore pagebreaks and CSV can ignore nearly everything.

Does something like this exist on CPAN? If it doesn't, does it exist anywhere? Or, would I be starting from scratch?

------
We are the carpenters and bricklayers of the Information Age.

Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.

Replies are listed 'Best First'.
Re: Format-independent layout
by perrin (Chancellor) on Jan 06, 2003 at 23:06 UTC
    People have tried making widget libraries for multiple output formats. They tend not to do well, because they compromise a lot and are not able to generate exciting enough PDF, HTML, etc. because they don't exploit the format specific features. Depending on how many reports you have, you may find it simpler to just use a templating solution with different templates for each output format. Or if you feel like going on an XML kick, you can do most of this XSL and XSL-FO.