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

FreeBSD Manual Pages

  
 
  

home | help
MouseX::NativeTraits::User(Contributed Perl DocumMouseX::NativeTraits::Bool(3)

NAME
       MouseX::NativeTraits::Bool - Helper trait for Bool attributes

SYNOPSIS
	 package Room;
	 use Mouse;

	 has 'is_lit' => (
	     traits    => ['Bool'],
	     is	       => 'rw',
	     isa       => 'Bool',
	     default   => 0,
	     handles   => {
		 illuminate  =>	'set',
		 darken	     =>	'unset',
		 flip_switch =>	'toggle',
		 is_dark     =>	'not',
	     },
	 );

	 my $room = Room->new();
	 $room->illuminate;	# same as $room->is_lit(1);
	 $room->darken;		# same as $room->is_lit(0);
	 $room->flip_switch;	# same as $room->is_lit(not $room->is_lit);
	 return	$room->is_dark;	# same as !$room->is_lit

DESCRIPTION
       This provides a simple boolean attribute, which supports	most of	the
       basic math operations.

PROVIDED METHODS
       These methods are implemented in
       MouseX::NativeTraits::MethodProvider::Bool. It is important to note
       that all	those methods do in place modification of the value stored in
       the attribute.

       set Sets	the value to true.

       unset
	   Set the value to false.

       toggle
	   Toggles the value. If it's true, set	to false, and vice versa.

       not Equivalent of 'not $value'.

METHODS
       meta
       method_provider_class
       helper_type

SEE ALSO
       MouseX::NativeTraits.

perl v5.24.1			  2012-11-26	 MouseX::NativeTraits::Bool(3)

NAME | SYNOPSIS | DESCRIPTION | PROVIDED METHODS | METHODS | SEE ALSO

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

home | help