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  -  MO::OPTION (3)

.ds Aq ’

Name

Mo::option - Allow an attribute to be a chainable, boolean option.

CONTENTS

Synopsis



    package Foo;

    use Mo qwoption;
    has this => ( option => 1 );
    has that => ( option => 1 );

    my $f = Foo->new;
    $f->this->that(0)->do_something;

    my $this = $f->read_this;   # 1
    my $that = $f->read_that;   # 0

    $f->do_something if $f->read_this;



Description

This feature lets an accessor act as an option, that is intended to have a value of 1 or 0. Simply calling the accessor sets the value to 1, and returns the instance so you can chain to the next method.

To get the value of the attribute, call the read_<name> accessor. Here’s a trick to do that when you are not assigning the value to anything:

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


perl v5.20.3 MO::OPTION (3) 2014-09-04

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