Skip Menu |
 

This queue is for tickets about the App-Options CPAN distribution.

Report information
The Basics
Id: 60737
Status: open
Priority: 0/
Queue: App-Options

People
Owner: Nobody in particular
Requestors: sharyanto [...] cpan.org
Cc:
AdminCc:

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



Subject: Delay some stuffs to INIT phase?
Download (untitled) / with headers
text/plain 916b
Currently, when we do a "perl -c script.pl" for a script that uses 'use App::Options (option => { foo => ... });' we see something like this: Error: "dest" is a required option but is not defined Error: "src" is a required option but is not defined Usage: script.pl [options] [args] --help print this message (also -?) --delete [0] (boolean) --dest=<value> [undef] (string) --log_level=<value> [DEBUG] (string) --profile=<value> [default] (string) --src=<value> [undef] (string) Which is pretty confusing and unintuitive. Would it be possible to move this checking to INIT phase, so the compilation step does not execute this code? I understand that some App::Options code needs to be done in BEGIN, as per the manual, to modify @INC etc.
Subject: Re: [rt.cpan.org #60737] Delay some stuffs to INIT phase?
Date: Wed, 25 Aug 2010 17:43:58 -0400
To: bug-App-Options [...] rt.cpan.org
From: Stephen Adkins <spadkins [...] gmail.com>
Download (untitled) / with headers
text/plain 1.6k
Hi, I'm not sure why that is confusing and unintuitive. You seemingly defined "src" and "dest" as "required" options. Would it be better if the message said Error: "dest" is a required option but is not provided on the command line, from the environment, or from an option file ? Stephen On Wed, Aug 25, 2010 at 2:01 PM, steven haryanto via RT < bug-App-Options@rt.cpan.org> wrote: Show quoted text
> Wed Aug 25 14:01:39 2010: Request 60737 was acted upon. > Transaction: Ticket created by SHARYANTO > Queue: App-Options > Subject: Delay some stuffs to INIT phase? > Broken in: (no value) > Severity: Normal > Owner: Nobody > Requestors: sharyanto@cpan.org > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=60737 > > > > Currently, when we do a "perl -c script.pl" for a script that uses > 'use App::Options (option => { foo => ... });' we see something like > this: > > Error: "dest" is a required option but is not defined > Error: "src" is a required option but is not defined > Usage: script.pl [options] [args] > --help print this message (also -?) > --delete [0] (boolean) > --dest=<value> [undef] (string) > --log_level=<value> [DEBUG] (string) > --profile=<value> [default] (string) > --src=<value> [undef] (string) > > Which is pretty confusing and unintuitive. Would it be possible to move > this checking to INIT phase, so the compilation step does not execute > this code? I understand that some App::Options code needs to be done in > BEGIN, as per the manual, to modify @INC etc. > > >
Download (untitled) / with headers
text/plain 2.1k
Sorry for not being clear before. What's confusing and unintuitive for me is not the messages themselves (which are perfectly fine for me), but the fact that using "perl -c" (check Perl syntax) still executes the App::Options' option checking, when I expect nothing to be output, since I am only testing my code. Steven On Wed Aug 25 17:44:08 2010, SPADKINS wrote: Show quoted text
> Hi, > > I'm not sure why that is confusing and unintuitive. > You seemingly defined "src" and "dest" as "required" options. > Would it be better if the message said > > Error: "dest" is a required option but is not provided on the command
line, Show quoted text
> from the environment, or from an option file > > ? > > Stephen > > On Wed, Aug 25, 2010 at 2:01 PM, steven haryanto via RT < > bug-App-Options@rt.cpan.org> wrote: >
> > Wed Aug 25 14:01:39 2010: Request 60737 was acted upon. > > Transaction: Ticket created by SHARYANTO > > Queue: App-Options > > Subject: Delay some stuffs to INIT phase? > > Broken in: (no value) > > Severity: Normal > > Owner: Nobody > > Requestors: sharyanto@cpan.org > > Status: new > > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=60737 > > > > > > > Currently, when we do a "perl -c script.pl" for a script that uses > > 'use App::Options (option => { foo => ... });' we see something like > > this: > > > > Error: "dest" is a required option but is not defined > > Error: "src" is a required option but is not defined > > Usage: script.pl [options] [args] > > --help print this message (also
-?) Show quoted text
> > --delete [0] (boolean) > > --dest=<value> [undef] (string) > > --log_level=<value> [DEBUG] (string) > > --profile=<value> [default] (string) > > --src=<value> [undef] (string) > > > > Which is pretty confusing and unintuitive. Would it be possible to
move Show quoted text
> > this checking to INIT phase, so the compilation step does not
execute Show quoted text
> > this code? I understand that some App::Options code needs to be
done in Show quoted text
> > BEGIN, as per the manual, to modify @INC etc. > > > > > >
Subject: Re: [rt.cpan.org #60737] Delay some stuffs to INIT phase?
Date: Wed, 25 Aug 2010 23:03:19 -0400
To: bug-App-Options [...] rt.cpan.org
From: Stephen Adkins <spadkins [...] gmail.com>
Download (untitled) / with headers
text/plain 2.6k
Hi, OK. Call that a known issue... a quirk of the module. I don't even know how I would fix that without requiring the using program to make a second call which would reduce the simplicity of using the module. Stephen On Wed, Aug 25, 2010 at 9:04 PM, steven haryanto via RT < bug-App-Options@rt.cpan.org> wrote: Show quoted text
> Queue: App-Options > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=60737 > > > Sorry for not being clear before. What's confusing and unintuitive for > me is not the messages themselves (which are perfectly fine for me), > but the fact that using "perl -c" (check Perl syntax) still executes > the App::Options' option checking, when I expect nothing to be output, > since I am only testing my code. > > Steven > > > On Wed Aug 25 17:44:08 2010, SPADKINS wrote:
> > Hi, > > > > I'm not sure why that is confusing and unintuitive. > > You seemingly defined "src" and "dest" as "required" options. > > Would it be better if the message said > > > > Error: "dest" is a required option but is not provided on the command
> line,
> > from the environment, or from an option file > > > > ? > > > > Stephen > > > > On Wed, Aug 25, 2010 at 2:01 PM, steven haryanto via RT < > > bug-App-Options@rt.cpan.org> wrote: > >
> > > Wed Aug 25 14:01:39 2010: Request 60737 was acted upon. > > > Transaction: Ticket created by SHARYANTO > > > Queue: App-Options > > > Subject: Delay some stuffs to INIT phase? > > > Broken in: (no value) > > > Severity: Normal > > > Owner: Nobody > > > Requestors: sharyanto@cpan.org > > > Status: new > > > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=60737 > > > > > > > > > > Currently, when we do a "perl -c script.pl" for a script that uses > > > 'use App::Options (option => { foo => ... });' we see something like > > > this: > > > > > > Error: "dest" is a required option but is not defined > > > Error: "src" is a required option but is not defined > > > Usage: script.pl [options] [args] > > > --help print this message (also
> -?)
> > > --delete [0] (boolean) > > > --dest=<value> [undef] (string) > > > --log_level=<value> [DEBUG] (string) > > > --profile=<value> [default] (string) > > > --src=<value> [undef] (string) > > > > > > Which is pretty confusing and unintuitive. Would it be possible to
> move
> > > this checking to INIT phase, so the compilation step does not
> execute
> > > this code? I understand that some App::Options code needs to be
> done in
> > > BEGIN, as per the manual, to modify @INC etc. > > > > > > > > >
> > > >
Download (untitled) / with headers
text/plain 3.4k
Hi, As I understand it, the need to do stuffs in BEGIN block is solely for "perlinc"? And it is unlikely that this feature will be removed? (I personally never use it and have always used the more standard "use lib" to add custom library paths, but understandably some users of App::Options will have already used "perlinc"). My suggestion would be: in read_options(), instead of directly printing the errors, collect them in @errors or something and print this (along with print_usage()) in a separate subroutine and call that subroutine in INIT block. Regards, Steven On Wed Aug 25 23:03:30 2010, SPADKINS wrote: Show quoted text
> Hi, > > OK. Call that a known issue... a quirk of the module. > I don't even know how I would fix that without requiring the using
program Show quoted text
> to make a second call which would reduce the simplicity of using the
module. Show quoted text
> > Stephen > > On Wed, Aug 25, 2010 at 9:04 PM, steven haryanto via RT < > bug-App-Options@rt.cpan.org> wrote: >
> > Queue: App-Options > > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=60737 > > > > > Sorry for not being clear before. What's confusing and unintuitive
for Show quoted text
> > me is not the messages themselves (which are perfectly fine for me), > > but the fact that using "perl -c" (check Perl syntax) still executes > > the App::Options' option checking, when I expect nothing to be
output, Show quoted text
> > since I am only testing my code. > > > > Steven > > > > > > On Wed Aug 25 17:44:08 2010, SPADKINS wrote:
> > > Hi, > > > > > > I'm not sure why that is confusing and unintuitive. > > > You seemingly defined "src" and "dest" as "required" options. > > > Would it be better if the message said > > > > > > Error: "dest" is a required option but is not provided on the
command Show quoted text
> > line,
> > > from the environment, or from an option file > > > > > > ? > > > > > > Stephen > > > > > > On Wed, Aug 25, 2010 at 2:01 PM, steven haryanto via RT < > > > bug-App-Options@rt.cpan.org> wrote: > > >
> > > > Wed Aug 25 14:01:39 2010: Request 60737 was acted upon. > > > > Transaction: Ticket created by SHARYANTO > > > > Queue: App-Options > > > > Subject: Delay some stuffs to INIT phase? > > > > Broken in: (no value) > > > > Severity: Normal > > > > Owner: Nobody > > > > Requestors: sharyanto@cpan.org > > > > Status: new > > > > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=60737 > > > > > > > > > > > > > Currently, when we do a "perl -c script.pl" for a script that
uses Show quoted text
> > > > 'use App::Options (option => { foo => ... });' we see something
like Show quoted text
> > > > this: > > > > > > > > Error: "dest" is a required option but is not defined > > > > Error: "src" is a required option but is not defined > > > > Usage: script.pl [options] [args] > > > > --help print this message
(also Show quoted text
> > -?)
> > > > --delete [0] (boolean) > > > > --dest=<value> [undef] (string) > > > > --log_level=<value> [DEBUG] (string) > > > > --profile=<value> [default] (string) > > > > --src=<value> [undef] (string) > > > > > > > > Which is pretty confusing and unintuitive. Would it be possible
to Show quoted text
> > move
> > > > this checking to INIT phase, so the compilation step does not
> > execute
> > > > this code? I understand that some App::Options code needs to be
> > done in
> > > > BEGIN, as per the manual, to modify @INC etc. > > > > > > > > > > > >
> > > > > > > >
Subject: Re: [rt.cpan.org #60737] Delay some stuffs to INIT phase?
Date: Sat, 28 Aug 2010 17:33:50 -0400
To: bug-App-Options [...] rt.cpan.org
From: Stephen Adkins <spadkins [...] gmail.com>
Download (untitled) / with headers
text/plain 4.2k
OK. I get it. I'll think about adding that. In the mean time, I hope you are enjoying the module. Stephen P.S. I am uploading a new major revision which implements secure options (they don't print in plain text for --help). Also, a site-wide policy file exists (/etc/app/policy.conf) in which a "security_policy_level = 2" setting can enforce that passwords are never supplied from insecure places. On Wed, Aug 25, 2010 at 11:35 PM, steven haryanto via RT < bug-App-Options@rt.cpan.org> wrote: Show quoted text
> Queue: App-Options > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=60737 > > > Hi, > > As I understand it, the need to do stuffs in BEGIN block is solely for > "perlinc"? And it is unlikely that this feature will be removed? (I > personally never use it and have always used the more standard "use > lib" to add custom library paths, but understandably some users of > App::Options will have already used "perlinc"). > > My suggestion would be: in read_options(), instead of directly printing > the errors, collect them in @errors or something and print this (along > with print_usage()) in a separate subroutine and call that subroutine > in INIT block. > > Regards, > Steven > > > On Wed Aug 25 23:03:30 2010, SPADKINS wrote:
> > Hi, > > > > OK. Call that a known issue... a quirk of the module. > > I don't even know how I would fix that without requiring the using
> program
> > to make a second call which would reduce the simplicity of using the
> module.
> > > > Stephen > > > > On Wed, Aug 25, 2010 at 9:04 PM, steven haryanto via RT < > > bug-App-Options@rt.cpan.org> wrote: > >
> > > Queue: App-Options > > > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=60737 > > > > > > > Sorry for not being clear before. What's confusing and unintuitive
> for
> > > me is not the messages themselves (which are perfectly fine for me), > > > but the fact that using "perl -c" (check Perl syntax) still executes > > > the App::Options' option checking, when I expect nothing to be
> output,
> > > since I am only testing my code. > > > > > > Steven > > > > > > > > > On Wed Aug 25 17:44:08 2010, SPADKINS wrote:
> > > > Hi, > > > > > > > > I'm not sure why that is confusing and unintuitive. > > > > You seemingly defined "src" and "dest" as "required" options. > > > > Would it be better if the message said > > > > > > > > Error: "dest" is a required option but is not provided on the
> command
> > > line,
> > > > from the environment, or from an option file > > > > > > > > ? > > > > > > > > Stephen > > > > > > > > On Wed, Aug 25, 2010 at 2:01 PM, steven haryanto via RT < > > > > bug-App-Options@rt.cpan.org> wrote: > > > >
> > > > > Wed Aug 25 14:01:39 2010: Request 60737 was acted upon. > > > > > Transaction: Ticket created by SHARYANTO > > > > > Queue: App-Options > > > > > Subject: Delay some stuffs to INIT phase? > > > > > Broken in: (no value) > > > > > Severity: Normal > > > > > Owner: Nobody > > > > > Requestors: sharyanto@cpan.org > > > > > Status: new > > > > > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=60737 > > > > > > > > > > > > > > > > Currently, when we do a "perl -c script.pl" for a script that
> uses
> > > > > 'use App::Options (option => { foo => ... });' we see something
> like
> > > > > this: > > > > > > > > > > Error: "dest" is a required option but is not defined > > > > > Error: "src" is a required option but is not defined > > > > > Usage: script.pl [options] [args] > > > > > --help print this message
> (also
> > > -?)
> > > > > --delete [0] (boolean) > > > > > --dest=<value> [undef] (string) > > > > > --log_level=<value> [DEBUG] (string) > > > > > --profile=<value> [default] (string) > > > > > --src=<value> [undef] (string) > > > > > > > > > > Which is pretty confusing and unintuitive. Would it be possible
> to
> > > move
> > > > > this checking to INIT phase, so the compilation step does not
> > > execute
> > > > > this code? I understand that some App::Options code needs to be
> > > done in
> > > > > BEGIN, as per the manual, to modify @INC etc. > > > > > > > > > > > > > > >
> > > > > > > > > > > >
> > > >


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

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