GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
MooseX::App::Plugin::MutexGroup(3) User Contributed Perl Documentation MooseX::App::Plugin::MutexGroup(3)

MooseX::App::Plugin::MutexGroup - Adds mutually exclusive options

In your base class:

 package MyApp;
 use MooseX::App qw(MutexGroup);
 
 option 'UseAmmonia' => (
   is         => 'ro',
   isa        => 'Bool',
   mutexgroup => 'NonMixableCleaningChemicals',
 );
 
 option 'UseChlorine' => (
   is         => 'ro',
   isa        => 'Bool',
   mutexgroup => 'NonMixableCleaningChemicals'
 );

In your script:

 #!/usr/bin/env perl
 
 use strict;
 use warnings;
 
 use MyApp;
 
 MyApp->new_with_options( UseAmmonia => 1, UseChlorine => 1 );
 # generates Error
 # More than one attribute from mutexgroup NonMixableCleaningChemicals('UseAmmonia','UseChlorine') *cannot* be specified
 
 MyApp->new_with_options();
 # generates Error
 # One attribute from mutexgroup NonMixableCleaningChemicals('UseAmmonia','UseChlorine') *must* be specified
 
 MyApp->new_with_options( UseAmmonia => 1 );
 # generates no errors
 
 MyApp->new_with_options( UseChlorine => 1 );
 # generates no errors

This plugin adds mutually exclusive options to your application. In the current implementation, all defined MutexGroups *must* have exactly one initialized option. This means that there is an implicit requiredness of one option from each MutexGroup.
2021-08-15 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.