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
MooseX::HasDefaults(3) User Contributed Perl Documentation MooseX::HasDefaults(3)
 

MooseX::HasDefaults - default "is" to "ro" or "rw" for all attributes

    package Person;
    use Moose;
    use MooseX::HasDefaults::RO;
    has name => (
        isa => 'Str',
    );
    has age => (
        is  => 'rw',
        isa => 'Int',
        documentation => "Changes most years",
    );

The module MooseX::HasDefaults::RO defaults "is" to "ro".
The module MooseX::HasDefaults::RW defaults "is" to "rw".
If you pass a specific value to any "has"'s "is", that overrides the default. If you do not want an accessor, pass "is => undef".

Shawn M Moore, "sartak@gmail.com"

MooseX::AttributeDefaults
This requires its users to be MOP savvy, and is a bit too much typing for the common case of defaulting "is".
MooseX::Attributes::Curried
This solves a similar need by letting users create sugar functions. But people like "has".

Copyright 2009 Infinity Interactive
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
2010-07-24 perl v5.28.1

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

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