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


Manual Reference Pages  -  MOUSEX::NATIVETRAITS::BOOL (3)

.ds Aq ’

NAME

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

CONTENTS

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.
<B>setB> Sets the value to true.
<B>unsetB> Set the value to false.
<B>toggleB> Toggles the value. If it’s true, set to false, and vice versa.
<B>notB> Equivalent of ’not $value’.

METHODS

<B>metaB>
<B>method_provider_classB>
<B>helper_typeB>

SEE ALSO

MouseX::NativeTraits.
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 MOUSEX::NATIVETRAITS::BOOL (3) 2012-11-26

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