[Purdue-pm] interpolate perl variables in pod
westerman at purdue.edu
Fri Dec 5 09:51:53 PST 2014
Mark's links, especially
were ones that I had already read and were the ones that gave me the idea to extract variables from POD.
I think that we all agree that POD is outdated -- a different document engine within Perl would be nice. And we probably all agree that a two-step method -- compile'n'run or pro'n'latex or POD-preprocessor -- would provide for a more powerful solution albeit at the cost of having two or more files for every program. However what I am trying to show is a neat POD hack within the confines of what is universal -- POD inside the single executable file.
----- Original Message -----
> Another followup to Rick's message about sharing Perl
> variable values in Perl and POD.
> From http://www.perlmonks.org/?node_id=714673
> As JavaFan and GrandFather have already mentioned, no, you can't
> directly. However, there's nothing to stop you from generating a POD
> document from a perl script:
> open (my $pod, '>', 'filename.pod') or die "Can't write pod file: $!";
> my $my_perl_variable = 'something';
> print $pod <<EOF;
> =head1 Imaginary Interpolation
> This was defined previously: C<$my_perl_variable>
> Of course, this would mean that you'd have to trigger the re-writing
> process somehow ... if you were to give an interface for updating
> whatever your variables were, you could regenerate the pod
> afterwards. I personally couldn't see the advantage of doing this,
> but I don't know what your full intentions are.
> http://www.perlmonks.org/?node_id=714673 links to
> which has some more ideas.
> http://www.perlmonks.org/?node_id=714673 also links to
> which didn't contain much usefil information in my opinion.
> (Or, maybe just replace, for example ---VERSION---, in
> a program.pl-replace file with sed to make a program.pl file.
> This has the advantage if you want to sync version numbers
> on multiple programs and/or docs without making any file changes.
> I used this type of thing for a project I did years ago
> and it worked out prettty well.)
westerman at purdue.edu
Bioinformatics specialist at the Genomics Facility.
Phone: (765) 494-0505 FAX: (765) 496-7255
Department of Horticulture and Landscape Architecture
625 Agriculture Mall Drive
West Lafayette, IN 47907-2010
Physically located in room S049, WSLR building
More information about the Purdue-pm