Ciao Monks, it's nice to be back again in the monastery!

I have a question about basic password checking; I already took a look at Data::Password and, in the monastery, to this and this other node (I also tried SuperSearch to check in FAQ and Categorized Questions/Answers, but I got too much garbage and gave up).

What I need is to do just a minimal check, in particular:

While the first two points are really easy to code:

sub validate_password { my ($field,$pass) = @_ ; my $minlen = 5 ; return "Field $field: Password too short (min. $minlen chars)" if length($pass) < $minlen ; return "Field $field: Please use alphabetics and digits (at least)" unless $pass =~ /[a-z/i and $pass =~ /\d/ ; ...

I'm not sure how to manage the third point in a clear and efficient manner, where clear means that the code is enough readable for me to understand when I'll get back to the code after 3 months :-) and efficient is that it doesn require years to run.

I gave up Data::Password because it was too general and UNIX oriented (I'd like my program to be portable). Similarly, Authen::PAM and Crypt::Cracklib don't suit my needs

Any clues?

Ciao!
--bronto


The very nature of Perl to be like natural language--inconsistant and full of dwim and special cases--makes it impossible to know it all without simply memorizing the documentation (which is not complete or totally correct anyway).
--John M. Dlugosz

In reply to Minimal password check, again by bronto

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.