On Fri, 4 May 2012 20:27:36 +0200 Paul Johnson <p...@pjcj.net> wrote:
> On Fri, May 04, 2012 at 08:16:01PM +0200, Manfred Lotz wrote: > > Hi there, > > I'm looking for a Perl preprocessor which should roughly be able to > > work like this: > > > > In a document I have begin and end markers, say ## for both. Between > > those end markers there is perl code which should be run and > > everything which goes to stdout should go into the document. > > > > The code should be lexical in a way that later code could refer to > > previous code. > > > > Primitive example: > > > > This is a sample document. > > ## my $name = 'Manfred Lotz'; ## > > My name is ## print $name; ## and I'm from Germany. > > > > should result in the following document: > > > > This is a sample document. > > My name is Manfred Lotz and I'm from Germany. > > > > > > Does anybody know about a module which could do this? > > That sounds like something that Mason could do. And I expect there > are a number of other modules on CPAN that could also manage that. > But take a look at https://metacpan.org/module/Mason > > Good luck, > Thanks to both (Uri) of you for your reply. I recognize that my example was bad. If I just would like to substitute stuff then of course a Template module would be best. But let us say I want to do calculations in a larger document. Perhaps define somes subroutines I could use later. I'm just looking into Mason, and wow, it seems to have quite some capabilities. So I will investigate this further. -- Thanks again, Manfred -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/