Scroll to navigation

Pod::UsageTrans(3pm) User Contributed Perl Documentation Pod::UsageTrans(3pm)


Pod::UsageTrans, pod2usage() - print a usage message from embedded pod documentation


  use Pod::UsageTrans
  use Locale::gettext;
  my $message_text  = "This text precedes the usage message.";
  my $exit_status   = 2;          ## The exit status to use
  my $verbose_level = 0;          ## The verbose level to use
  my $filehandle    = \*STDERR;   ## The filehandle to write to
  my $textdomain    = 'prog-pod'; ## The gettext domain for the Pod documentation
  pod2usage( { -message => gettext( $message_text ) ,
               -exitval => $exit_status  ,
               -verbose => $verbose_level,
               -output  => $filehandle,
               -textdomain => $textdomain } );
  pod2usage(   -msg     => $message_text ,
               -exitval => $exit_status  ,
               -verbose => $verbose_level,
               -output  => $filehandle,
               -textdomain => $textdomain );


Pod::UsageTrans works exactly like Pod::Usage but allows you to easily translate your messages. It was specifically written to be compatible with the .po files produced by po4a(7). If you want to use any other method to produce your .po files you should probably take a look at the source of code of this module to see which msgids you will need to use.

For documentation on calling pod2usage from your program see Pod::Usage. Pod::UsageTrans additionally supports a "-textdomain" option where you can specify the gettext domain to use. If "-textdomain" isn't set, Pod::UsageTrans will behave exactly like Pod::Usage.


Pod::UsageTrans is currently in the state of a quickly hacked together solution that was tested with exactly one use case. Expect bugs in corner cases.

It specifically doesn't support many of the po4a options like charset conversion between the POD input and the msgstr in the .pot file.


po4a(7), Pod::Usage, gettext info documentation


Frank Lichtenheld, <>

Based on Pod::Usage by Brad Appleton <> which is based on code for Pod::Text::pod2text() written by Tom Christiansen <>

Also based on Locale::Po4a::Pod, Locale::Po4a::Po and Locale::Po4a::TransTractor by Martin Quinson and Denis Barbier.

2018-10-29 perl v5.26.2