Dear Master Monks,

Why does pod2usage("$0: No files given.") if ( ( @ARGV == 0 ) && ( -t STDIN ) ); render my menu useless?

#!/usr/bin/perl ########################################################## # # # Author: Gavin Henry # # Web: http://www.perl.me.uk # # # # Version: 0.1 - 29.09.05 # # # # Quick wrapper script to convert an avi # # to a dvd image, using howto at: # # # # http://mightylegends.zapto.org/dvd/dvdauthor_howto.php # # # # Licence: GPL # # # ########################################################## use strict; use warnings; use IO::Prompt; use Pod::Usage; use Getopt::Long; # Straight from the Pod::Usage docs ###################### my $man = 0; my $help = 0; ## Parse options and print usage if there is a syntax error, ## or if usage was explicitly requested. GetOptions( 'help|?' => \$help, man => \$man ) or pod2usage(2); pod2usage(1) if $help; pod2usage( -verbose => 2 ) if $man; ## If no arguments were given, then allow STDIN to be used only ## if it's not connected to a terminal (otherwise print usage) pod2usage("$0: No files given.") if ( ( @ARGV == 0 ) && ( -t STDIN ) ) +; ########################################################## # After we have tested to see we were given a filename and to be # used for later my $avi = $ARGV[0]; # use menu option from IO::Prompt my $choice = prompt 'Please choose your format...', -1, -menu => [ 'PAL', 'NTSC', 'Quit', ]; print "You chose: [$choice]\n\n"; # This is where all the encoding will go once I have figured # out what's wrong with the menu above if ( $choice eq 'PAL' ) { print "You must be in Europe or Australia, encoding to PAL format\ +n"; } elsif ( $choice eq 'NTSC' ) { print "You must be in America, encoding to NTSC format\n"; } elsif ( $choice eq 'Quit' ) { print "Bye, bye\n"; exit 0; } else { print "Nothing selected.\n"; exit 0; } __END__ =head1 NAME avi2dvd - a Perl wrapper script for converting an avi to dvd image =head1 SYNOPSIS ./avi2dvd avifile =head1 DESCRIPTION Following http://mightylegends.zapto.org/dvd/dvdauthor_howto.php I got sick of typing all the commands, so wrote this little wrapper script. It uses: IO::Prompt Pod::Usage Getopt::Long =head1 SEE ALSO http://mightylegends.zapto.org/dvd/dvdauthor_howto.php =head1 VERSION This man page documents avi2dvd version 0.1 =head1 CREDITS Rick Harris: http://mightylegends.zapto.org/dvd/dvdauthor_howto.php =head1 AUTHOR name : Gavin Henry email : ghenry at perl dot me dot uk web : http://www.perl.me.uk PM : http://aberdeen.pm.org =head1 COPYRIGHT Copyright (c) 2005 by Gavin Henry =head1 LICENSE This package is free software; you can redistribute it and/or modify i +t under the terms of the "GNU General Public License". Please refer to http://www.gnu.org/licenses/gpl.txt for details. =head1 DISCLAIMER This package is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the "GNU General Public License" for more details.
Thanks.

Walking the road to enlightenment... I found a penguin and a camel on the way.....
Fancy a yourname@perl.me.uk? Just ask!!!

In reply to Using IO::Prompt's menu by ghenry

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.