Author: dylan
Date: 2005-01-01 02:43:59 -0500 (Sat, 01 Jan 2005)
New Revision: 503

Added:
   trunk/main/core/lib/Haver/Config.pm
Modified:
   trunk/main/server/lib/Haver/Server/Object/User.pm
Log:
adding Haver::Config, again... svn is weird sometimes. :P


Added: trunk/main/core/lib/Haver/Config.pm
===================================================================
--- trunk/main/core/lib/Haver/Config.pm 2005-01-01 07:31:33 UTC (rev 502)
+++ trunk/main/core/lib/Haver/Config.pm 2005-01-01 07:43:59 UTC (rev 503)
@@ -0,0 +1,64 @@
+# vim: set ft=perl ts=4 sw=4 sta si ai tw=100 expandtab:
+# Haver::Config - Config manager.
+# 
+# Copyright (C) 2004 Dylan William Hardison.
+# 
+# This module is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This module is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this module; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+package Haver::Config;
+use strict;
+use warnings;
+use base 'Haver::Base';
+use YAML ();
+
+our $VERSION = 0.08;
+
+sub initialize {
+    my ($me) = @_;
+
+    $me->{default} ||= {};
+
+    if ($me->{file}) {
+        $me->load($me->{file});
+    }
+}
+
+
+sub load {
+    my ($me, $file) = @_;
+    my $config;
+
+    if (-e $file) {
+        $config = YAML::LoadFile($file);
+    } else {
+        $config = { %{ $me->{default} } };
+    }
+
+    $me->{config} = $config;
+}
+
+sub save {
+    my ($me, $file) = @_;
+    $file ||= $me->{file};
+
+    YAML::DumpFile($file, $me->{config});
+}
+
+sub config {
+    my ($me) = @_;
+    
+    $me->{config};
+}
+
+1;

Modified: trunk/main/server/lib/Haver/Server/Object/User.pm
===================================================================
--- trunk/main/server/lib/Haver/Server/Object/User.pm   2005-01-01 07:31:33 UTC 
(rev 502)
+++ trunk/main/server/lib/Haver/Server/Object/User.pm   2005-01-01 07:43:59 UTC 
(rev 503)
@@ -31,56 +31,12 @@
 sub initialize {
        my ($me) = @_;
 
-       $me->SUPER::initialize();
-       $me->{_access}   = {};
-
-       $me->set(
-               '+role' => 'user',
-       );
-
-
-
+       $me->{_access} = {};
 }
 
 
-sub _save_data {
-       my ($me) = @_;
-       my $data = $me->SUPER::_save_data();
 
-       
-       #$data->{access} = $me->{_access};
-
-       return $data;
+sub grant {
+    
 }
 
-sub _load_data {
-       my ($me, $data) = @_;
-       $me->SUPER::_load_data($data);
-       #$me->{_access} = $data->{access};
-
-       return 1;
-}
-
-
-
-sub namespace {
-       'user'
-}
-
-
-1;
-__END__
-=head1 NAME
-
-Haver::Server::Object::User - Object representation of a user.
-
-=head1 SYNOPSIS
-
-
-
-=head1 DESCRIPTION
-
-This module is a representation of a user. It's rather pointless, but it gives
-you a warm fuzzy feeling. In the future, it might store the users in a 
database or something.
-
-


Reply via email to