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:
>
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.
> > > >
> > > >
> > > >
> >
> >
> >
> >