title: How to get Getopt::Long + pod2usage working?
body: <p>I'm about to go nuts so here I am :)</p>
  
  <p>I'm trying to make documentation for my Perl program, but I never manage to get Getopt::Long and pod2man working.</p>
  
  <p>Here is a simple program I wrote for testing purpose:</p>
  
  <pre><code>#!/usr/bin/perl
  use strict;
  use warnings;
  use Getopt::Long;
  use Pod::Usage;
  
  Getopt::Long::Configure ("bundling");
  
  my $option = "";
  my $verbose = 1;
  my $quiet = 0;
  my $man = 0;
  my $help = 0;
  
  GetOptions (
          "option=s" =&gt; \$option,
          "verbose" =&gt; sub { $verbose = 1; $quiet = 0 },
          "quiet|noverbose" =&gt; sub { $verbose = 0; $quiet = 1 },
          "help|?" =&gt; \$help,
          man =&gt; \$man
  ) or pod2usage("Error in command line.\n");
  
  pod2usage(1) if $help;
  pod2usage(-exitval =&gt; 0, -verbose =&gt; 2) if $man;
  
  print "my programm here\n";
  
  __END__
  =head1 NAME
  
  my-prog.pl - Customized mysqldump utility
  
  =head1 SYNOPSIS
  
          my-prog.pl [OPTIONS]
          Options:
                  -help brief help message
                  -man full documentation
  
  =head1 OPTIONS
  
  =over 8
  
  =item B&lt;--help&gt;
  
  Print a brief help message and exits.
  
  =item B&lt;--man&gt;
  
  Prints the manual page and exits.
  
  =item B&lt;--option&gt;
  
  Option description
  
  =item B&lt;--verbose&gt;
  
  Option description
  
  =back
  
  =head1 DESCRIPTION
  
  B&lt;my-prog.pl&gt; is doing something.
  
  =head1 AUTHOR
  
  B&lt;Me&gt;
  
  =cut
  </code></pre>
  
  <p>Unfortunately, when I do this :</p>
  
  <p>./my-prog.pl --help</p>
  
  <p>Nothing appears. Worse, when I do this :</p>
  
  <p>./my-prog.pl --man</p>
  
  <p>I get kind of a curses page with my whole program in it (every line of my program, not just the help manual).</p>
  
  <p>Before I go crazy and just go back with a custom print_help() subroutine, could you please help me?</p>
  
  <p>Thanks in advance :)</p>
  
  <p>EDIT 1: Program modified thanks to @toolic. Now, my --help works fine but --man is showing me the whole source code of my program in a "man" like page. I run this script with Perl 5.14.2 on Debian Wheezy.</p>