---
name: "MooseX::Has::Sugar::Saccharin"
section: "3pm"
platform: "linux"
package: "libmoosex-has-sugar-perl"
version: "1.000006-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/MooseX::Has::Sugar::Saccharin"
---

# MooseX::Has::Sugar::Saccharin(3pm)

Experimental sweetness

## NAME

MooseX::Has::Sugar::Saccharin - Experimental sweetness

## VERSION

version 1.000006

## SYNOPSIS

This is a highly experimental sugaring module. No Guarantees of stability.

```
    use MooseX::Types::Moose qw( :all );
    has name   => rw Str, default { 1 };
    has suffix => required rw Str;
    has 'suffix', required rw Str;
```

Your choice.

## EXPORT GROUPS

### ":default"

exports:

"ro", "rw", "required", "lazy", "lazy\_build", "coerce", "weak\_ref", "auto\_deref", "bare", "default", "init\_arg", "predicate", "clearer", "builder", "trigger"

## EXPORTED FUNCTIONS

### "bare"

### "bare" $Type

```
    bare Str
```

equivalent to this

```
    is => 'bare', isa => Str
```

### "ro"

### "ro" $Type

```
    ro Str
```

equivalent to this

```
    is => 'ro', isa => Str,
```

### "rw"

### "rw" $Type

```
    rw Str
```

equivalent to this

```
    is => 'rw', isa => Str
```

### "required"

### "required @rest"

this

```
    required rw Str
```

is equivalent to this

```
    required => 1, is => 'rw', isa => Str,
```

this

```
    rw Str, required
```

is equivalent to this

```
    is => 'rw', isa => Str , required => 1
```

### "lazy"

### "lazy @rest"

like `"( lazy => 1 , @rest )"`

### "lazy\_build"

### "lazy\_build @rest"

like `"( lazy_build => 1, @rest )"`

### "weak\_ref"

### "weak\_ref @rest"

like `"( weak_ref => 1, @rest )"`

### "coerce"

### "coerce @rest"

like `"( coerce => 1, @rest )"`

*WARNING:*

Conflicts with `"MooseX::Types's"` `"coerce"` method

### "auto\_deref"

### "auto\_deref @rest"

like `"( auto_deref => 1, @rest )"`

### "builder"

### "builder $buildername"

```
    required rw Str, builder '_build_foo'
```

is like

```
    builder => '_build_foo'
```

### "predicate"

### "predicate $predicatename"

see "builder"

### "clearer"

### "clearer $clearername"

see "builder"

### "init\_arg"

### "init\_arg $argname"

see "builder"

### "default"

### "default { $code }"

Examples:

```
    default { 1 }
    default { { } }
    default { [ ] }
    default { $_->otherfield }
```

`$_` is localized as the same value as `$_`\[0\] for convenience ( usually `$self` )

### "trigger"

### "trigger { $code }"

Works exactly like default.

## CONFLICTS

### MooseX::Has::Sugar

### MooseX::Has::Sugar::Minimal

This module is not intended to be used in conjunction with\
  ::Sugar or ::Sugar::Minimal

We export many of the same symbols and its just not very sensible.

### MooseX::Types

### Moose::Util::TypeConstraints

due to exporting the "coerce" symbol, using us in the same scope as a call to

```
    use MooseX::Types ....
```

or\
     use Moose::Util::TypeConstraints

will result in a symbol collision.

We recommend using and creating proper type libraries instead, ( which will absolve you entirely of the need to use MooseX::Types and MooseX::Has::Sugar(::\*)? in the same scope )

### Perl 5.010 feature 'switch'

the keyword 'default' becomes part of Perl in both these cases:

```
    use 5.010;
    use feature qw( :switch );
```

As such, we can't have that keyword in that scenario.

## AUTHOR

Kent Fredric \<kentnl@cpan.org\>

## COPYRIGHT AND LICENSE

This software is copyright (c) 2017 by Kent Fredric \<kentfredric@gmail.com\>.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
