Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
MooseX::App::Plugin::MUserGContributed Perl MooseX::App::Plugin::MutexGroup(3)

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

SYNOPSIS
       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

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

perl v5.32.0			  2019-05-13MooseX::App::Plugin::MutexGroup(3)

NAME | SYNOPSIS | DESCRIPTION

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=MooseX::App::Plugin::MutexGroup&sektion=3&manpath=FreeBSD+12.1-RELEASE+and+Ports>

home | help