in reply to Moose: mutualy exclusive bolean attributes.
See Moose::Util::TypeConstraints#!/usr/bin/perl package Foo; use Moose; use Moose::Util::TypeConstraints; enum 'Status' => qw(success error pending); has 'status' => (is => 'rw', isa => 'Status|Undef'); package main; use strict; use warnings; my $o = Foo->new; foreach (undef, 'success', 'bar', 'error') { $o->status($_); printf "status: %s\n", $o->status; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Moose: mutualy exclusive bolean attributes.
by ikegami (Patriarch) on Dec 23, 2010 at 15:58 UTC | |
by chrestomanci (Priest) on Dec 24, 2010 at 10:52 UTC | |
by ikegami (Patriarch) on Dec 24, 2010 at 17:53 UTC | |
by chrestomanci (Priest) on Dec 26, 2010 at 08:12 UTC | |
by ikegami (Patriarch) on Dec 28, 2010 at 22:44 UTC |