This queue is for tickets about the IO-Prompt CPAN distribution.

Report information
The Basics
Id:
21345
Status:
new
Priority:
Low/Low
Queue:

People
Owner:
Nobody in particular
Requestors:
geoff.crompton [...] strategicdata.com.au
Cc:
AdminCc:

BugTracker
Severity:
(no value)
Broken in:
(no value)
Fixed in:
(no value)



MIME-Version: 1.0
X-Spam-Status: No, hits=-2.6 required=8.0 tests=BAYES_00,SPF_HELO_PASS,SPF_PASS
X-Accept-Language: en-us, en
Received-SPF: pass (x1.develooper.com: domain of geoff.crompton@strategicdata.com.au designates 203.214.67.82 as permitted sender)
content-type: text/plain; charset="utf-8"
Received: from la.mx.develooper.com (ss1.fabel.dk [63.251.223.179]) by diesel.bestpractical.com (Postfix) with SMTP id 1B2F44D8111 for <bug-IO-Prompt@rt.cpan.org>; Wed, 6 Sep 2006 02:59:42 -0400 (EDT)
Received: (qmail 25361 invoked by alias); 6 Sep 2006 06:59:41 -0000
Received: from sdcarl02.strategicdata.com.au (HELO sdcarl02.strategicdata.com.au) (203.214.67.82) by la.mx.develooper.com (qpsmtpd/0.28) with ESMTP; Tue, 05 Sep 2006 23:59:39 -0700
Received: from [192.168.1.64] (carthanach.mel.strategicdata.com.au [192.168.1.64]) by sdcarl02.strategicdata.com.au (Postfix) with ESMTP id 11256C0022CD for <bug-IO-Prompt@rt.cpan.org>; Wed, 6 Sep 2006 16:59:32 +1000 (EST)
Delivered-To: cpan-bug+io-prompt@diesel.bestpractical.com
User-Agent: Debian Thunderbird 1.0.2 (X11/20060829)
Subject: -require checks ignore for -default value
Return-Path: <geoff.crompton@strategicdata.com.au>
X-Original-To: bug-IO-Prompt@rt.cpan.org
X-Spam-Check-BY: la.mx.develooper.com
Date: Wed, 06 Sep 2006 16:59:31 +1000
Message-Id: <44FE71D3.7010608@strategicdata.com.au>
To: bug-IO-Prompt@rt.cpan.org
X-Enigmail-Version: 0.91.0.0
Content-Transfer-Encoding: 7bit
From: Geoff Crompton <geoff.crompton@strategicdata.com.au>
X-RT-Original-Encoding: ISO-8859-1
Content-Length: 743
Hi, If you supply a -default value, the -require checks are bypassed. I'm using IO-Prompt-v0.99.2. For example, the following code accepts the default, even thougth the default doesn't meet the first require about lenght, and may not meet the second require if the user already exists. prompt('Enter clients user name: ', -default => 'geoff', -require => { # Require username to be at least 6 chars long 'Username to short, enter another one:' => sub { m{ .{6,} }x; }, # Require usename does not already exist 'Username already exists, enter another one:' => sub { !getpwnam($_); }, }, ); -- Geoff Crompton Debian System Administrator Strategic Data +61 3 9340 9000
MIME-Version: 1.0
X-Spam-Status: No, hits=-2.6 required=8.0 tests=BAYES_00,SPF_HELO_PASS,SPF_PASS
In-Reply-To: <rt-3.6.HEAD-2106-1157525989-1018.21345-3-0@rt.cpan.org>
Received-SPF: pass (x1.develooper.com: domain of geoff.crompton@strategicdata.com.au designates 203.214.67.82 as permitted sender)
References: <RT-Ticket-21345@rt.cpan.org> <44FE71D3.7010608@strategicdata.com.au> <rt-3.6.HEAD-2106-1157525989-1018.21345-3-0@rt.cpan.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
X-RT-Original-Encoding: utf-8
Received: from la.mx.develooper.com (x1.develooper.com [63.251.223.170]) by diesel.bestpractical.com (Postfix) with SMTP id 324BB4D80A6 for <bug-IO-Prompt@rt.cpan.org>; Mon, 11 Sep 2006 19:20:48 -0400 (EDT)
Received: (qmail 16570 invoked by alias); 11 Sep 2006 23:20:47 -0000
Received: from sdcarl02.strategicdata.com.au (HELO sdcarl02.strategicdata.com.au) (203.214.67.82) by la.mx.develooper.com (qpsmtpd/0.28) with ESMTP; Mon, 11 Sep 2006 16:20:43 -0700
Received: from [192.168.1.64] (carthanach.mel.strategicdata.com.au [192.168.1.64]) by sdcarl02.strategicdata.com.au (Postfix) with ESMTP id A43C4C002DDA for <bug-IO-Prompt@rt.cpan.org>; Tue, 12 Sep 2006 09:20:34 +1000 (EST)
Delivered-To: cpan-bug+io-prompt@diesel.bestpractical.com
Subject: Re: [rt.cpan.org #21345] AutoReply: -require checks ignore for -default value
User-Agent: Thunderbird 1.5.0.5 (X11/20060812)
Return-Path: <geoff.crompton@strategicdata.com.au>
X-Spam-Check-BY: la.mx.develooper.com
X-Original-To: bug-IO-Prompt@rt.cpan.org
Date: Tue, 12 Sep 2006 09:20:34 +1000
Message-Id: <4505EF42.8040500@strategicdata.com.au>
To: bug-IO-Prompt@rt.cpan.org
Content-Transfer-Encoding: 7bit
From: Geoff Crompton <geoff.crompton@strategicdata.com.au>
X-RT-Original-Encoding: utf-8
RT-Message-ID: <rt-3.6.HEAD-433-1158016850-206.21345-0-0@rt.cpan.org>
Content-Length: 1236
Show quoted text
> Hi, > > If you supply a -default value, the -require checks are bypassed. > > I'm using IO-Prompt-v0.99.2. For example, the following code accepts the > default, even thougth the default doesn't meet the first require about > lenght, and may not meet the second require if the user already exists. > > prompt('Enter clients user name: ', > -default => 'geoff', > -require => { > > # Require username to be at least 6 chars long > 'Username to short, enter another one:' => sub { m{ .{6,} > }x; }, > > # Require usename does not already exist > 'Username already exists, enter another one:' => sub { !getpwnam($_); }, > }, > ); >
After some discussion with Damien, and another developer at work, it seems my idea is a bit wonky. The general consensus is that doing this is a bit out of scope for IO::Prompt, and that it isn't real smart to feed an incorrect value in as a default. If you are generating a default value based on other sources, it will be cleaner code if you create it such that it can't be an invalid answer, or you sanity check it before calling prompt(). -- Geoff Crompton Debian System Administrator Strategic Data +61 3 9340 9000


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.