Re: Neat way of checking that two hash values both exist?

Discussion in 'Perl Misc' started by hymie!, Aug 27, 2012.

  1. hymie!

    hymie! Guest

    In our last episode, the evil Dr. Lacto had captured our hero,
    Henry Law <>, who said:

    >The logic of the utility requires both flags -h and -p to be specified
    >or neither. I'm coding the part that checks whether that is true.


    I know this is outside the scope of your question ... but if the
    flags must either both be specified or both be unspecified, then why
    do you have two flags?

    --hymie! http://lactose.homelinux.net/~hymie
    -------------------------------------------------------------------------------
     
    hymie!, Aug 27, 2012
    #1
    1. Advertising

  2. hymie!

    Tim McDaniel Guest

    In article <503bc165$0$13259$>,
    hymie! <> wrote:
    >In our last episode, the evil Dr. Lacto had captured our hero,
    > Henry Law <>, who said:
    >
    >>The logic of the utility requires both flags -h and -p to be specified
    >>or neither. I'm coding the part that checks whether that is true.

    >
    >I know this is outside the scope of your question ... but if the
    >flags must either both be specified or both be unspecified, then why
    >do you have two flags?


    The option parsing modules that I know of allow no more than one
    string value argument for a single option. If you need two option
    values for a given purpose and you're using such a module, then you
    have to accomodate it.

    (I can imagine being pedantic and wanting to make something clear to
    the user that option 1 implies option 2 by requiring them to enter
    both options, but I don't know of any commands that do that.)

    --
    Tim McDaniel,
     
    Tim McDaniel, Aug 27, 2012
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. korean_dave
    Replies:
    0
    Views:
    291
    korean_dave
    Jul 24, 2008
  2. rp
    Replies:
    1
    Views:
    596
    red floyd
    Nov 10, 2011
  3. Joshua Muheim
    Replies:
    8
    Views:
    218
    Dejan Dimic
    Nov 23, 2007
  4. Tim McDaniel
    Replies:
    2
    Views:
    396
    Tim McDaniel
    Aug 27, 2012
  5. Replies:
    7
    Views:
    122
    Wolfgang Maier
    Mar 27, 2013
Loading...

Share This Page