Verby::Config::Data::Mutable - Verby::Config::Data::Mutable documentation


Verby documentation Contained in the Verby distribution.

Index


Code Index:

NAME

Top

Verby::Config::Data::Mutable -

SYNOPSIS

Top

	use Verby::Config::Data::Mutable;

DESCRIPTION

Top

METHODS

Top

set
export
export_all

BUGS

Top

None that we are aware of. Of course, if you find a bug, let us know, and we will be sure to fix it.

CODE COVERAGE

Top

We use Devel::Cover to test the code coverage of the tests, please refer to COVERAGE section of the Verby module for more information.

SEE ALSO

Top

AUTHOR

Top

Yuval Kogman, <nothingmuch@woobling.org>

COPYRIGHT AND LICENSE

Top


Verby documentation Contained in the Verby distribution.

#!/usr/bin/perl

package Verby::Config::Data::Mutable;
use Moose;

extends qw/Verby::Config::Data/;

our $VERSION = "0.05";

use Carp qw/croak/;

sub set {
	my ( $self, $field, $value ) = @_;

	$self->data->{$field} = $value;
}

sub export {
	my ( $self, $field ) = @_;

	if ($self->exists($field)){
		my $value = $self->extract($field);
		foreach my $parent ($self->parents){
			$parent->set($field, $value);
		}
	} else {
		croak "key $field does not exist in $self";
	}
}

sub export_all {
	my $self = shift;
	foreach my $field (keys %{ $self->data }){
		$self->export($field);
	}
}

__PACKAGE__

__END__