Ask a Question related to PERL Beginners, Design and Development.

  1. #1

    Default Help with options

    Hi,

    I have a script that command options are taken and would like to know
    how print out the options when the options are missing from the command
    line. Or how to do a -h to print out the options.

    Thanks,
    Thomas Browner



    tbrowner@digidyne.com Guest

  2. Similar Questions and Discussions

    1. DNS Options?
      Am in the process of setting up a 2003 domain and understand that DNS is essential, any advice would be greatly appreciated. A future step will be...
    2. What is an options key?
      What is an options key & where is it?
    3. OS options for Sun PC
      Hi all! I have these old Sun PC cards. (Not the latest version) I have never felt like installing any PC-software on my nice and clean...
    4. SET OPTIONS
      Can someone tell me how I can tell what set options a procedure has, I am looking for any procedure or view that has SET QUOTED_IDENTIFIER OFF OR...
    5. Options and creating a macro for options
      I have a database that i use for work and have set up to have 10-12 option groups on one page. Normally I would "hit" the "Pass" option (the other...
  3. #2

    Default RE: Help with options

    > Hi,
    >
    > I have a script that command options are taken and would like
    > to know how print out the options when the options are
    > missing from the command line. Or how to do a -h to print out
    > the options.
    >
    There are module sto help you process switches and what not.
    For really simple stuff I do:

    if($ARGV[0] eq '-h') { print "Here is how to use this script...."; }
    elsif(!defined $ARGV[1]) { print "You must specify the Foo for Monkey, try -h for help..."; }

    Something like that anyway.

    HTH

    DMuey
    > Thanks,
    > Thomas Browner
    >
    >
    >
    >
    > --
    > To unsubscribe, e-mail: [email]beginners-unsubscribe@perl.org[/email]
    > For additional commands, e-mail: [email]beginners-help@perl.org[/email]
    <http://learn.perl.org/> <http://learn.perl.org/first-response>


    Dan Muey Guest

  4. #3

    Default RE: Help with options

    Getopt::long

    [url]http://search.cpan.org/~jv/Getopt-Long-2.34/lib/Getopt/Long.pm[/url]


    Paul Kraus
    -----------------------
    PEL Supply Company
    Network Administrator
    > -----Original Message-----
    > From: Thomas Browner [mailto:thomas.browner@digidyne.com] On Behalf Of
    > [email]tbrowner@digidyne.com[/email]
    > Sent: Tuesday, January 27, 2004 5:22 PM
    > To: [email]beginners@perl.org[/email]
    > Subject: Help with options
    >
    > Hi,
    >
    > I have a script that command options are taken and would like to know
    > how print out the options when the options are missing from the command
    > line. Or how to do a -h to print out the options.
    >
    > Thanks,
    > Thomas Browner
    >
    >
    >
    >
    > --
    > To unsubscribe, e-mail: [email]beginners-unsubscribe@perl.org[/email]
    > For additional commands, e-mail: [email]beginners-help@perl.org[/email]
    > <http://learn.perl.org/> <http://learn.perl.org/first-response>

    Paul Kraus Guest

  5. #4

    Default RE: Help with options

    I realize there's no 'help' in this one, but maybe this will get you on
    your way...(it's a bit of a kluge; I had to check it twice)

    Here's one with GetOpt::Std :
    ##########################
    use Getopt::Std;

    my @ARGS;
    my %opts;
    eval
    {
    getopts('o:L', \%opts) or die "Usage: $0 -o [ mail || file ]
    [-L]\n\t where\t-o mail = mailed output OR -o file = output to
    files\n\t\t-L = create log file\n";
    die "Usage: $0 -o [ mail || file ] [-L]\n\t where\t-o mail =
    mailed output OR -o file = output to files\n\t\t-L = create log file\n"
    unless ( (exists $opts{o})&&(($opts{o} eq "mail")||($opts{o} eq
    "file")));
    };
    if ( $@ ) {
    #mail & die
    ....
    }
    ###########################

    At 12:21 PM 1/28/04 -0500, you wrote:
    >Getopt::long
    >
    >[url]http://search.cpan.org/~jv/Getopt-Long-2.34/lib/Getopt/Long.pm[/url]
    >
    >
    > Paul Kraus
    > -----------------------
    > PEL Supply Company
    > Network Administrator
    >
    > > -----Original Message-----
    > > From: Thomas Browner [mailto:thomas.browner@digidyne.com] On Behalf Of
    > > [email]tbrowner@digidyne.com[/email]
    > > Sent: Tuesday, January 27, 2004 5:22 PM
    > > To: [email]beginners@perl.org[/email]
    > > Subject: Help with options
    > >
    > > Hi,
    > >
    > > I have a script that command options are taken and would like to know
    > > how print out the options when the options are missing from the command
    > > line. Or how to do a -h to print out the options.
    > >
    > > Thanks,
    > > Thomas Browner
    > >
    > >
    > >
    > >
    > > --
    > > To unsubscribe, e-mail: [email]beginners-unsubscribe@perl.org[/email]
    > > For additional commands, e-mail: [email]beginners-help@perl.org[/email]
    > > <http://learn.perl.org/> <http://learn.perl.org/first-response>
    >
    >
    >
    >--
    >To unsubscribe, e-mail: [email]beginners-unsubscribe@perl.org[/email]
    >For additional commands, e-mail: [email]beginners-help@perl.org[/email]
    ><http://learn.perl.org/> <http://learn.perl.org/first-response>
    Tim Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139