Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Is what you want available?

by Arunbear (Prior)
on Jun 09, 2017 at 12:22 UTC ( [id://1192425]=note: print w/replies, xml ) Need Help??


in reply to Is what you want available?

"random_month" could be made more user friendly by supporting keyword arguments e.g.
my $random_month = random_month(-lang=> 'English', -abbrev=> 1);
You may also consider supporting ISO 639-1 codes for the language specifier
my $random_month = random_month(-lang=> 'en', -abbrev=> 1); my $random_German_month = random_month(-lang=> 'de');
Also, there are good reasons for not using fatal warnings.

Replies are listed 'Best First'.
Re^2: Is what you want available?
by Lady_Aleena (Priest) on Jun 10, 2017 at 04:33 UTC

    How is adding even more typing user-friendly, especially when there is only 1 variable? Also, since there is only 1 language I have abbreviations for, it seems a bit silly to make a user type in a second variable for it, when I would have to do something like the following in the subroutine to make it read.

    my $language = $opt{'lang'}.' '.$opt{'abbr'};

    Wouldn't it be less of a headache to just have an all in one without splitting the hash key name between two variables?

    my $month = random_month('English abbr'); -or- my $month = random_month( 'lang' => 'English', 'abbr' => 1 );

    I also expanded the selection of languages and how the languages can be selected.

    About fatal warnings, I leave them in for me. I consider all warnings as bad as errors, because something is not right with the code if I'm being warned about it. If I were to ever make any module "official", I would it them out.

    No matter how hysterical I get, my problems are not time sensitive. So, relax, have a cookie, and a very nice day!
    Lady Aleena
      User friendliness includes having sensible defaults. English is a sensible default language. So if I wanted a random month in the default language I'd expect to be able to do
      my $month = random_month();
      Now if I wanted an abbreviated random month in the default language I'd expect to be able to do
      my $month = random_month(-abbrev => 1);
      Language and abbreviation are two distinct concepts, which indicates you need two parameters to handle them cleanly,

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1192425]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (6)
As of 2024-04-23 22:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found