Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^2: Moo and command line scripts

by boftx (Deacon)
on Nov 09, 2019 at 20:11 UTC ( [id://11108518]=note: print w/replies, xml ) Need Help??


in reply to Re: Moo and command line scripts
in thread Moo and command line scripts

Thanks, I'll take a look at that. I'm not completely comfortable with the environment variable myself but all of my tests seem to show it works properly.

You must always remember that the primary goal is to drain the swamp even when you are hip-deep in alligators.

Replies are listed 'Best First'.
Re^3: Moo and command line scripts
by tobyink (Canon) on Nov 11, 2019 at 08:42 UTC

    Yeah, it only becomes an issue if you're loading two classes that consume MooX::Role::CliOptions, and they each want different settings for the environment variable. None of your tests do that.

    use 5.006; use strict; use warnings; use Test::More; { package My::Class1; use Moo; $ENV{MRC_NO_STDOPTS} = 1; # do NOT want 'debug' and 'verbose' with 'MooX::Role::CliOptions'; } { package My::Class2; use Moo; $ENV{MRC_NO_STDOPTS} = 0; # do want 'debug' and 'verbose' with 'MooX::Role::CliOptions'; } ok( ! My::Class1->new->can('verbose') ); ok( My::Class2->new->can('verbose') ); done_testing;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11108518]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2024-04-25 20:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found