Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: Mixing documentation and data (hash, i18n/ gettext/.po/.mo)

by Anonymous Monk
on Feb 01, 2013 at 08:04 UTC ( #1016476=note: print w/ replies, xml ) Need Help??

in reply to Mixing documentation and data

Well, if you want to stick with perl, and don't want to duplicate the data, two ways

__DATA__ =head1 ERROR MESSAGES =item * eof Unexpected end of file =cut

Then when you're reading from *DATA, adjust your regex

Or better idea, make it what it is, a hash

$ podchecker junk junk pod syntax OK. $ perldoc junk ERROR MESSAGES %E2S = ( eof => 'Unexpected end of file', ); $ perl -Mstrict -Mwarnings junk { eof => "Unexpected end of file" } $ cat junk BEGIN { use vars qw' %E2S '; my $pod = <<'=head1 ERROR MESSAGES'; =head1 ERROR MESSAGES %E2S = ( eof => 'Unexpected end of file', ); =for no_pod_formatter =cut } use Data::Dump; dd\%E2S; $

and even better idea is to use gettext, and generate the pod from your .po/.mo database, using whatever means,
a utils/gettexttopod.PL (or utils/gettexttopod ) you wrote, or whatever

Comment on Re: Mixing documentation and data (hash, i18n/ gettext/.po/.mo)
Select or Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1016476]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (10)
As of 2015-11-30 14:26 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (771 votes), past polls