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

FreeBSD Manual Pages

  
 
  

home | help
MooseX::App::Plugin::DUserdContributed Perl DocMooseX::App::Plugin::Depends(3)

NAME
       MooseX::App::Plugin::Depends - Adds dependent options

SYNOPSIS
       In your base class:

	package	MyApp;
	use MooseX::App	qw(Depends);

	use Moose::Util::TypeConstraints;

	option 'FileFormat' => (
	  is  => 'ro',
	  isa => enum( [qw(tsv csv xml)] ),
	);

	option 'WriteToFile' =>	(
	  is	   => 'ro',
	  isa	   => 'Bool',
	  depends => [qw(FileFormat)],
	);

       In your script:

	#!/usr/bin/env perl

	use strict;
	use warnings;

	use MyApp;

	MyApp->new_with_options( WriteToFile =>	1 );
	# generates Error
	# Option 'WriteToFile' requires	'FileFormat' to	be defined

	MyApp->new_with_options( WriteToFile =>	1, FileFormat => 'tsv );
	# generates no errors

	MyApp->new_with_options();
	# generates no errors

DESCRIPTION
       In many real-world scenarios, sets of options are, by design, needed to
       be specified together. This plugin adds the ability to create dependent
       options to your application, options that require one or	more other
       options for your	application to perform properly.

perl v5.32.0			  2019-05-13   MooseX::App::Plugin::Depends(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::Depends&sektion=3&manpath=FreeBSD+12.1-RELEASE+and+Ports>

home | help