[Bps-public-commit] r12405 - in Prophet/trunk: .

sartak at bestpractical.com sartak at bestpractical.com
Fri May 16 10:33:21 EDT 2008


Author: sartak
Date: Fri May 16 10:33:07 2008
New Revision: 12405

Modified:
   Prophet/trunk/   (props changed)
   Prophet/trunk/lib/Prophet/App.pm

Log:
 r56026 at onn:  sartak | 2008-05-16 10:32:51 -0400
 Prophet::App->config('key'), Prophet::App->config(key => 'value')


Modified: Prophet/trunk/lib/Prophet/App.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/App.pm	(original)
+++ Prophet/trunk/lib/Prophet/App.pm	Fri May 16 10:33:07 2008
@@ -4,10 +4,15 @@
 package Prophet::App;
 use base qw/Class::Accessor/;
 use Path::Class;
-__PACKAGE__->mk_accessors(qw/_resdb_handle/);
+__PACKAGE__->mk_accessors(qw/_resdb_handle _config/);
 
 use constant DEFAULT_REPLICA_TYPE => 'prophet';
 
+=head1 NAME
+
+Prophet::App
+
+=cut
 
 sub _handle {
     my $self = shift;
@@ -89,5 +94,31 @@
     $@ = '';
 }
 
+=head2 config
+
+If called with no arguments, returns the L<Prophet::Config> instance.
+
+If called with one arguments, returns the value of that config setting.
+
+If called with two arguments, sets the value of that config setting.
+
+=cut
+
+sub config {
+    my $self = shift;
+
+    unless ($self->_config) {
+        require Prophet::Config;
+        $self->_config(Prophet::Config->new);
+    }
+
+    return $self->_config if @_ == 0;
+
+    my $key = shift;
+    return $self->_config->get($key) if @_ == 0;
+
+    my $value = shift;
+    return $self->_config->set($key => $value);
+}
 
 1;



More information about the Bps-public-commit mailing list