barefootcoder/Data-Random

Documented 'chars' character set is actually named 'misc'

Closed this issue · 1 comments

The documentation for rand_chars states:

  • set - the set of characters to be used. This value can be either a reference to an array of strings, or one of the following:
alpha        - alphabetic characters: a-z, A-Z
upperalpha   - upper case alphabetic characters: A-Z
loweralpha   - lower case alphabetic characters: a-z
numeric      - numeric characters: 0-9
alphanumeric - alphanumeric characters: a-z, A-Z, 0-9
char         - non-alphanumeric characters: # ~ ! @ $ % ^ & * ( ) _ + = - { } | : " < > ? / . ' ; ] [ \ `
all          - all of the above

However, the code sets that character set when set has been set to "misc" instead, which is not a documented character name.

Setting set to "char" defaults to the empty set, which results in the following odd behaviour:

srand(123) and rand_chars( set => "char" )
# size value exceeds set size at lib/Data/Random.pm line 209.
srand(123) and rand_chars( set => "misc" )
# &

Pull request #12 corrects this, I believe. Closing this one out.