| Class-Param documentation | Contained in the Class-Param distribution. |
Class::Param::Decorator - Class Param Decorator Class
package MyDecorator;
use base 'Class::Param::Decorator';
sub get {
# do something
}
Constructor. Takes one argument, an instance of Class::Param::Base.
Called after construction with same arguments given to constructor, should return the instance.
Returns the decorated Class::Param::Base instance.
This method simply performs $self-decorated->get> and returns the result.
This method simply performs $self-decorated->set> and returns the result.
This method simply performs $self-decorated->has> and returns the result.
This method simply performs $self-decorated->count> and returns the result.
This method simply performs $self-decorated->clear> and returns the result.
This method simply performs $self-decorated->names> and returns the result.
This method simply performs $self-decorated->remove> and returns the result.
Christian Hansen chansen@cpan.org
This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself.
| Class-Param documentation | Contained in the Class-Param distribution. |
package Class::Param::Decorator; use strict; use warnings; use base 'Class::Param::Base'; our $AUTOLOAD; use Params::Validate qw[]; sub new { my $class = ref $_[0] ? ref shift : shift; my $self = Params::Validate::validate_with( params => \@_, spec => [ { type => Params::Validate::OBJECT, isa => 'Class::Param::Base', optional => 0 } ], called => "$class\::new" ); return bless( $self, $class )->initialize(@_); } sub initialize { return $_[0]; } sub decorated { return $_[0]->[0]; } sub get { return shift->decorated->get (@_) } sub set { return shift->decorated->set (@_) } sub has { return shift->decorated->has (@_) } sub count { return shift->decorated->count (@_) } sub clear { return shift->decorated->clear (@_) } sub names { return shift->decorated->names (@_) } sub remove { return shift->decorated->remove (@_) } sub AUTOLOAD { my $self = shift; my $method = substr( $AUTOLOAD, rindex( $AUTOLOAD, ':' ) + 1 ); return $self->decorated->$method(@_); } sub DESTROY { } 1; __END__