-
-
03 Mar 2010 17:04:44 UTC
- Distribution: Class-Accessor-Assert
- Module version: 1.41
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Issues (0)
- Testers (555 / 0 / 1)
- Kwalitee
Bus factor: 0- 58.33% Coverage
- License: perl_5
- Activity
24 month- Tools
- Download (4.87KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
and 1 contributors- Steffen Mueller <accessor-module at steffen-mueller dot net>
- Dependencies
- Class::Accessor
- Class::Data::Inheritable
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
Class::Accessor::Assert - Accessors which type-check
SYNOPSIS
use Class::Accessor::Assert; __PACKAGE__->mk_accessors( qw( +foo bar=Some::Class baz @bits ) );
DESCRIPTION
This is a version of Class::Accessor which offers rudimentary type-checking and existence-checking of arguments to constructors and set accessors.
To specify that a member is mandatory in the constructor, prefix its name with a
+
. To specify that it needs to be of a certain class when setting that member, suffix=CLASSNAME
. Unblessed reference types such as=HASH
or=ARRAY
are acceptable.To specify that a member is an array, prefix its name with a
@
. These members also have the following four special methods that wrap the builtin array operationspush
,pop
,unshift
, andshift
:# for a @bits member: $y->bits_push(@new_values); print $y->bits_pop; $y->bits_unshift(@new_values); print $y->bits_shift;
The
@
can be combined with the+
prefix to make a member that is an array that you must set in the constructor. The+
must precede the@
.# 'foo' is required in the constructor __PACKAGE__->mk_accessors(qw( +@foo ));
SEE ALSO
AUTHOR
This module is maintained by
Steffen Mueller, accessor-module at steffen-mueller dot net
Original author is
Simon Cozens, simon@simon-cozens.org
Please direct inquiries, bug reports, etc. towards the maintainer, not the original author. Simon no longer provides support for this module, so please respect that.
COPYRIGHT AND LICENSE
Copyright 2003 by Simon Cozens
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Module Install Instructions
To install Class::Accessor::Assert, copy and paste the appropriate command in to your terminal.
cpanm Class::Accessor::Assert
perl -MCPAN -e shell install Class::Accessor::Assert
For more information on module installation, please visit the detailed CPAN module installation guide.