Padre

 view release on metacpan or  search on metacpan

lib/Padre/DB/HostConfig.pm  view on Meta::CPAN

package Padre::DB::HostConfig;

# NOTE: This class is loaded automatically by Padre::DB, overlaying the
# code already auto-generated by Padre::DB. Do not load manually, as this
# module will not function standalone.

# NOTE: Portable Perl support is NOT required for this class, as any
# necesary transforms are done by the relevant Padre::Config modules.

use 5.008;
use strict;
use warnings;
use Padre::Current ();

our $VERSION = '1.02';

sub read {
	my %config = map { $_->name => $_->value } $_[0]->select;
	return \%config;
}

sub write {
	my $class = shift;
	my $hash  = shift;

	my $transaction = Padre::Current->main->lock('DB');
	Padre::DB::HostConfig->truncate;
	foreach my $name ( sort keys %$hash ) {
		Padre::DB::HostConfig->create(
			name  => $name,
			value => $hash->{$name},
		);
	}

	return 1;
}

1;

__END__

=pod

=head1 NAME

Padre::DB::HostConfig - Padre::DB class for the host_config table

=head1 DESCRIPTION

TO BE COMPLETED

=head1 METHODS

=head2 base

  # Returns 'Padre::DB'
  my $namespace = Padre::DB::HostConfig->base;

Normally you will only need to work directly with a table class,
and only with one ORLite package.

However, if for some reason you need to work with multiple ORLite packages
at the same time without hardcoding the root namespace all the time, you



( run in 0.872 second using v1.01-cache-2.11-cpan-39bf76dae61 )