Skip Menu |

This queue is for tickets about the Text-Password-Pronounceable CPAN distribution.

Report information
The Basics
Id: 25367
Status: open
Priority: 0/
Queue: Text-Password-Pronounceable

People
Owner: Nobody in particular
Requestors: a.r.ferreira [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: [PATCH] minor patch fixing T::P::P->generate($len)
Date: Sat, 10 Mar 2007 19:21:34 -0300
To: clkao [...] clkao.org, bugs-Text-Password-Pronounceable [...] rt.cpan.org
From: "Adriano Ferreira" <a.r.ferreira [...] gmail.com>
The patch I provided at http://rt.cpan.org/Public/Bug/Display.html?id=23981 made "new($len)" and "$pp->generate($len)" work, but not "Text::Password::Pronounceable->generate($len)". This patch fixes that, besides tweaking the docs for a more precise description of the method signatures. It add a few more tests to check for the behavior of generate as a class method. ######## As a side note, the following tests actually pass, but should they be documented? Are they desirable behavior? { my $pp = Text::Password::Pronounceable->new(1, 10); my $str = $pp->generate(undef, 5); # $min = undef, so use $min = 1 ok(length($str) <= 5 && length($str) >= 1); $str = $pp->generate(0, 5); # $min = 0, so use $min = 1 ok(length($str) <= 5 && length($str) >= 1); $str = $pp->generate("", 5); # $min = "", so use $min = 1 ok(length($str) <= 5 && length($str) >= 1); } Maybe replacing this test and warning in the sub generate Carp::carp "min and max length must be defined" if !$min || !$max; by Carp::carp "min and max length must be defined" if $min>0 || $max>0; so that arguments are forced to be numbers is more sensible, discontinuing with the behavior exhibited above. But obviously it depends on the compatibility issues of the code. Kind regards, Adriano Ferreira.

Message body is not shown because sender requested not to inline it.

Was preparing to complain about the same thing, but the bug is open for three years now.<br /> <br /> Getting complains when using just the smaller size:<br /> min and max length must be defined at ...<br /> Use of uninitialized value $max in subtraction (-) at /usr/share/perl5/site_perl/5.10.0/Text/Password/Pronounceable.pm line 160.<br /> <br /> Why is $max optional in new, but not on generate?<br /> <br /> Cheers<br /> <br /> On Sat Mar 10 17:21:50 2007, a.r.ferreira@gmail.com wrote: <br /> &gt; The patch I provided at http://rt.cpan.org/Public/Bug/Display.html?id=23981 <br /> &gt; made &quot;new($len)&quot; and &quot;$pp-&gt;generate($len)&quot; work, but <br /> &gt; not &quot;Text::Password::Pronounceable-&gt;generate($len)&quot;. <br /> &gt; <br /> &gt; This patch fixes that, besides tweaking the docs for a more <br /> &gt; precise description of the method signatures. <br /> &gt; <br /> &gt; It add a few more tests to check for the behavior of generate <br /> &gt; as a class method. <br /> &gt; <br /> &gt; <br /> &gt; ######## <br /> &gt; <br /> &gt; As a side note, the following tests actually pass, <br /> &gt; but should they be documented? Are they desirable behavior? <br /> &gt; <br /> &gt; { <br /> &gt; my $pp = Text::Password::Pronounceable-&gt;new(1, 10); <br /> &gt; <br /> &gt; my $str = $pp-&gt;generate(undef, 5); # $min = undef, so use $min = 1 <br /> &gt; ok(length($str) &lt;= 5 &amp;&amp; length($str) &gt;= 1); <br /> &gt; <br /> &gt; $str = $pp-&gt;generate(0, 5); # $min = 0, so use $min = 1 <br /> &gt; ok(length($str) &lt;= 5 &amp;&amp; length($str) &gt;= 1); <br /> &gt; <br /> &gt; $str = $pp-&gt;generate(&quot;&quot;, 5); # $min = &quot;&quot;, so use $min = 1 <br /> &gt; ok(length($str) &lt;= 5 &amp;&amp; length($str) &gt;= 1); <br /> &gt; <br /> &gt; } <br /> &gt; <br /> &gt; Maybe replacing this test and warning in the sub generate <br /> &gt; <br /> &gt; Carp::carp &quot;min and max length must be defined&quot; if !$min || !$max; <br /> &gt; <br /> &gt; by <br /> &gt; <br /> &gt; Carp::carp &quot;min and max length must be defined&quot; if $min&gt;0 || $max&gt;0; <br /> &gt; <br /> &gt; so that arguments are forced to be numbers is more sensible, <br /> &gt; discontinuing with the behavior exhibited above. <br /> &gt; But obviously it depends on the compatibility issues of the <br /> &gt; code. <br /> &gt; <br /> &gt; Kind regards, <br /> &gt; Adriano Ferreira. <br /> <br /> <br />