r44929 - in /branches/upstream/libconfig-model-approx-perl/current: ./ lib/ lib/Config/ lib/Config/Model/ lib/Config/Model/models/ t/

ddumont-guest at users.alioth.debian.org ddumont-guest at users.alioth.debian.org
Sun Sep 27 16:34:40 UTC 2009


Author: ddumont-guest
Date: Sun Sep 27 16:34:36 2009
New Revision: 44929

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=44929
Log:
Load /tmp/tmp.oOVtbzOHv4/to_upload/Config-Model-Approx-1.002 into
branches/upstream/libconfig-model-approx-perl/current.

Added:
    branches/upstream/libconfig-model-approx-perl/current/Build.PL
    branches/upstream/libconfig-model-approx-perl/current/ChangeLog
    branches/upstream/libconfig-model-approx-perl/current/MANIFEST
    branches/upstream/libconfig-model-approx-perl/current/META.yml
    branches/upstream/libconfig-model-approx-perl/current/README
    branches/upstream/libconfig-model-approx-perl/current/config-edit-approx   (with props)
    branches/upstream/libconfig-model-approx-perl/current/lib/
    branches/upstream/libconfig-model-approx-perl/current/lib/Config/
    branches/upstream/libconfig-model-approx-perl/current/lib/Config/Model/
    branches/upstream/libconfig-model-approx-perl/current/lib/Config/Model/Approx.pm
    branches/upstream/libconfig-model-approx-perl/current/lib/Config/Model/models/
    branches/upstream/libconfig-model-approx-perl/current/lib/Config/Model/models/Approx.pl
    branches/upstream/libconfig-model-approx-perl/current/t/
    branches/upstream/libconfig-model-approx-perl/current/t/approx_config.t
    branches/upstream/libconfig-model-approx-perl/current/t/pod.t

Added: branches/upstream/libconfig-model-approx-perl/current/Build.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-model-approx-perl/current/Build.PL?rev=44929&op=file
==============================================================================
--- branches/upstream/libconfig-model-approx-perl/current/Build.PL (added)
+++ branches/upstream/libconfig-model-approx-perl/current/Build.PL Sun Sep 27 16:34:36 2009
@@ -1,0 +1,53 @@
+# $Author: ddumont $
+# $Date: 2009-09-27 16:02:38 +0200 (dim 27 sep 2009) $
+# $Revision: 1036 $
+
+#    Copyright (c) 2009 Dominique Dumont.
+#
+#    This file is part of Config-Model-Approx.
+#
+#    Config-Model is free software; you can redistribute it and/or
+#    modify it under the terms of the GNU Lesser Public License as
+#    published by the Free Software Foundation; either version 2.1 of
+#    the License, or (at your option) any later version.
+#
+#    Config-Model 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
+#    Lesser Public License for more details.
+#
+#    You should have received a copy of the GNU Lesser Public License
+#    along with Config-Model; if not, write to the Free Software
+#    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+#    02110-1301 USA
+
+use Module::Build;
+use Data::Dumper ;
+
+use warnings FATAL => qw(all) ;
+use strict ;
+
+
+my $build = Module::Build->new
+  (
+   module_name   => 'Config::Model::Approx',
+   license       => 'lgpl',
+   dist_author   => "Dominique Dumont (ddumont at cpan dot org)",
+   dist_abstract => "Approx configuration files editor",
+   script_files   => [ qw/config-edit-approx/ ],
+   requires      => {
+		     perl              => '5.8.0',
+		     'Config::Model'   => '0.637',
+		     'Log::Log4perl'   => 0 ,
+		    },
+   build_requires => { 'Test::Pod' => 0 },
+   recommends    => {
+                     'Config::Model::CursesUI' => 0, # Curses interface
+                     'Config::Model::TkUI'     => 0, # graphical interface
+                    },
+   add_to_cleanup => [qw/wr_test/] ,
+  );
+
+
+$build->add_build_element('pl');
+$build->create_build_script;

Added: branches/upstream/libconfig-model-approx-perl/current/ChangeLog
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-model-approx-perl/current/ChangeLog?rev=44929&op=file
==============================================================================
--- branches/upstream/libconfig-model-approx-perl/current/ChangeLog (added)
+++ branches/upstream/libconfig-model-approx-perl/current/ChangeLog Sun Sep 27 16:34:36 2009
@@ -1,0 +1,10 @@
+2009-09-27  Dominique Dumont  <domi.dumont at free.fr> 1.002
+
+	* README : updated license
+
+	* lib/Config/Model/Approx.pm : added missing doc
+
+2009-09-24  Dominique Dumont  <domi.dumont at free.fr> 1.001
+
+	* Initial release 
+

Added: branches/upstream/libconfig-model-approx-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-model-approx-perl/current/MANIFEST?rev=44929&op=file
==============================================================================
--- branches/upstream/libconfig-model-approx-perl/current/MANIFEST (added)
+++ branches/upstream/libconfig-model-approx-perl/current/MANIFEST Sun Sep 27 16:34:36 2009
@@ -1,0 +1,10 @@
+Build.PL
+ChangeLog
+MANIFEST			This list of files
+META.yml
+README
+config-edit-approx
+lib/Config/Model/Approx.pm
+lib/Config/Model/models/Approx.pl
+t/approx_config.t
+t/pod.t

Added: branches/upstream/libconfig-model-approx-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-model-approx-perl/current/META.yml?rev=44929&op=file
==============================================================================
--- branches/upstream/libconfig-model-approx-perl/current/META.yml (added)
+++ branches/upstream/libconfig-model-approx-perl/current/META.yml Sun Sep 27 16:34:36 2009
@@ -1,0 +1,28 @@
+---
+name: Config-Model-Approx
+version: 1.002
+author:
+  - Dominique Dumont (ddumont at cpan dot org)
+abstract: Approx configuration files editor
+license: lgpl
+resources:
+  license: http://opensource.org/licenses/lgpl-license.php
+build_requires:
+  Test::Pod: 0
+requires:
+  Config::Model: 0.637
+  Log::Log4perl: 0
+  perl: v5.8.0
+recommends:
+  Config::Model::CursesUI: 0
+  Config::Model::TkUI: 0
+configure_requires:
+  Module::Build: 0.35
+provides:
+  Config::Model::Approx:
+    file: lib/Config/Model/Approx.pm
+    version: 1.002
+generated_by: Module::Build version 0.35
+meta-spec:
+  url: http://module-build.sourceforge.net/META-spec-v1.4.html
+  version: 1.4

Added: branches/upstream/libconfig-model-approx-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-model-approx-perl/current/README?rev=44929&op=file
==============================================================================
--- branches/upstream/libconfig-model-approx-perl/current/README (added)
+++ branches/upstream/libconfig-model-approx-perl/current/README Sun Sep 27 16:34:36 2009
@@ -1,0 +1,54 @@
+
+Config::Model::Approx - Approx graphical configuration editor
+
+This module provides a graphical configuration editor for
+/etc/approx/approx.conf.
+
+Main dependencies:
+- Config::Model::TkUI
+- Config::Model
+
+Suggested dependencies:
+- Config::Model::CursesUI to get a curses interface for the editor
+
+Once this module is installed, you can run:
+
+  # config-edit-approx
+
+If config-edit fails to load your approx.conf, you can try config-edit
+with -force option.
+
+--------------------------------------------------------------------
+MODULE CONTENT
+
+This Perl modules contains several files (listed in MANIFEST). Here
+are the purpose of the main files:
+- Build.PL : script to build the Perl module. See Module::Build(3pm)
+- lib/Config/Model/models : directory containing Approx model
+  file (Approx.pl). 
+- lib/Config/Model/Approx.pm: Read and write approx.conf
+- t/ : non-regression tests
+
+--------------------------------------------------------------------
+
+AUTHOR
+    Copyright (c) 2009 Dominique Dumont.
+
+    This file is part of Config-Model-Approx. License is LGPL v2.1 or
+    any later version.
+
+    All help text provided in Approx models were extracted from
+    approx.conf(5) man page. I've slightly modified the text to better
+    suit an interactive editor.
+
+---------------------------------------------------------------------
+INSTALLATION
+
+   	tar zxvf <dist_file>.tar.gz 
+   	cd <dist_directory>
+   	perl Build.PL
+	./Build test
+
+If you want to install this software without packaging, type also:
+
+        ./Build install

Added: branches/upstream/libconfig-model-approx-perl/current/config-edit-approx
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-model-approx-perl/current/config-edit-approx?rev=44929&op=file
==============================================================================
--- branches/upstream/libconfig-model-approx-perl/current/config-edit-approx (added)
+++ branches/upstream/libconfig-model-approx-perl/current/config-edit-approx Sun Sep 27 16:34:36 2009
@@ -1,0 +1,146 @@
+#!/usr/bin/perl
+
+#    Copyright (c) 2009 Dominique Dumont.
+#
+#    This file is part of Config-Model-Approx.
+#
+#    Config-Model is free software; you can redistribute it and/or
+#    modify it under the terms of the GNU Lesser Public License as
+#    published by the Free Software Foundation; either version 2.1 of
+#    the License, or (at your option) any later version.
+#
+#    Config-Model 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
+#    Lesser Public License for more details.
+#
+#    You should have received a copy of the GNU Lesser Public License
+#    along with Config-Model; if not, write to the Free Software
+#    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+#    02110-1301 USA
+
+use strict ;
+use warnings ;
+
+my @command = (qw/config-edit -model Approx/, @ARGV) ;
+
+# print "Calling @command\n";
+
+exec(@command)
+  or die "Cannot call config-edit: $!\nIs Config::Model installed ?\n";
+
+__END__
+
+=head1 NAME
+
+config-edit-approx - Edit data of /etc/approx/approx.conf
+
+=head1 SYNOPSIS
+
+  # most users will want to run
+  config-edit-approx [options] [ commands  ... ]
+
+  # if you don't have a X server
+  config-edit-approx -ui curses [options] [ commands  ... ]
+
+  # if you don't like curses
+  config-edit-approx -ui shell [options] [ commands  ... ]
+
+  # if you are a sys admin
+  config-edit-approx -ui none [options]  commands  ...
+
+=head1 DESCRIPTION
+
+This program will edit the configuration data contained in
+F</etc/approx/approx.conf> (as root).
+
+You can specify commands as arguments that will be run on the
+configuration root before launching the UI. These command follow the
+syntax defined in L<Config::Model::Loader>.
+
+=head1 Options
+
+=over
+
+=item -ui
+
+Specify the user interface type. 
+
+=over
+
+=item *
+
+C<tk>: provides a Tk graphical interface (If L<Config::Model::TkUI> is
+installed).
+
+=item *
+
+C<curses>: provides a curses user interface (If
+L<Config::Model::CursesUI> is installed).
+
+=item *
+
+C<shell>: provides a shell like interface.  See L<Config::Model::TermUI>
+for details.
+
+=item *
+
+C<none>: No UI provided. Only command line arguments are handled.
+
+=back
+
+=item -verbose
+
+Be (very) verbose
+
+=item -debug
+
+Provide debug infos.
+
+=item -trace
+
+Provides a full stack trace when exiting on error.
+
+=item -force-load
+
+Load file even if error are found in data. Bad data are discarded
+
+=back
+
+=cut
+
+=head1 BUGS
+
+Original structure and comments of F</etc/approx/approx.conf> are
+lost. There's currently no Augeas lens for approx config data.
+
+=head1 SUPPORT
+
+For support, please check the following ressources:
+
+=over
+
+=item *
+
+The config-model wiki: L<http://config-model.wiki.sourceforge.net/>
+
+=item *
+
+The config-model users mailing list:
+L<http://lists.sourceforge.net/mailman/listinfo/config-model-users>
+
+=back
+
+=head1 AUTHOR
+
+Dominique Dumont, ddumont at cpan dot org
+
+=head1 SEE ALSO
+
+L<config-edit>, L<Config::Model>
+
+=cut
+
+
+
+

Propchange: branches/upstream/libconfig-model-approx-perl/current/config-edit-approx
------------------------------------------------------------------------------
    svn:executable = *

Added: branches/upstream/libconfig-model-approx-perl/current/lib/Config/Model/Approx.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-model-approx-perl/current/lib/Config/Model/Approx.pm?rev=44929&op=file
==============================================================================
--- branches/upstream/libconfig-model-approx-perl/current/lib/Config/Model/Approx.pm (added)
+++ branches/upstream/libconfig-model-approx-perl/current/lib/Config/Model/Approx.pm Sun Sep 27 16:34:36 2009
@@ -1,0 +1,171 @@
+# $Author: ddumont $
+# $Date: 2009-09-27 16:02:38 +0200 (dim 27 sep 2009) $
+# $Revision: 1036 $
+
+#    Copyright (c) 2009 Dominique Dumont.
+#
+#    This file is part of Config-Model-Approx.
+#
+#    Config-Model-Approx is free software; you can redistribute it and/or
+#    modify it under the terms of the GNU Lesser Public License as
+#    published by the Free Software Foundation; either version 2.1 of
+#    the License, or (at your option) any later version.
+#
+#    Config-Model-Approx 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
+#    Lesser Public License for more details.
+#
+#    You should have received a copy of the GNU Lesser Public License
+#    along with Config-Model; if not, write to the Free Software
+#    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+
+package Config::Model::Approx ;
+
+use strict ;
+use warnings ;
+
+use Carp ;
+use Log::Log4perl;
+use File::Copy ;
+use File::Path ;
+
+use vars qw($VERSION)  ;
+
+$VERSION = '1.002' ;
+
+my $logger = Log::Log4perl::get_logger(__PACKAGE__);
+
+sub read {
+    # keys are object , root,  config_dir, io_handle, file
+    my %args = @_ ;
+
+    $logger->info("loading config file $args{file}") if defined $args{file};
+
+    foreach ($args{io_handle}->getlines) {
+	chomp;
+	s/#.*//;
+	s/\s+/=/; # translate file in string loadable by C::M::Loader
+	next unless $_;
+	my $load = s/^\$// ? $_ : "distributions:".$_;
+	$args{object}->load($load) ;
+    }
+
+    return 1;
+}
+
+sub write {
+    my %args = @_ ;
+
+    $logger->info("writing config file $args{file}");
+    my $node = $args{object} ;
+    my $ioh  = $args{io_handle} ;
+
+    $ioh->print("# This file was written by Config::Model with Approx model\n");
+    $ioh->print("# You may modify the content of this file. Configuration \n");
+    $ioh->print("# modification will be preserved. Modification in the comments\n");
+    $ioh->print("# will be discarded\n\n");
+
+    # Using Config::Model::ObjTreeScanner would be overkill
+    foreach my $elt ($node->get_element_name) {
+	next if $elt eq 'distributions';
+
+	# write some documentation in comments
+	$ioh->print("# $elt:", $node->get_help(summary => $elt));
+	my $upstream_default = $node->fetch_element($elt) -> fetch('upstream_default') ;
+	$ioh->print(" ($upstream_default)") if defined $upstream_default;
+	$ioh->print("\n") ;
+
+	# write value
+	my $v = $node->grab_value($elt) ;
+	$ioh->printf("\$%-10s %s\n",$elt,$v) if defined $v ;
+	$ioh->print("\n") ;
+    }
+
+    my $h = $node->fetch_element('distributions') ;
+    $ioh->print("# ", $node->get_help(summary => 'distributions'),"\n");
+    foreach my $dname ($h->get_all_indexes) {
+	$ioh->printf("%-10s %s\n",$dname,
+		     $node->grab_value("distributions:$dname")
+		    ) ;
+    }
+    return 1;
+
+}
+
+1;
+
+=head1 NAME
+
+Config::Model::Approx - Approx configuration file editor
+
+=head1 SYNOPSIS
+
+ use Config::Model ;
+ my $model = Config::Model -> new ( ) ;
+
+ my $inst = $model->instance (root_class_name   => 'Approx');
+ my $root = $inst -> config_root ;
+
+ $root->load("distribution:multimedia=http://www.debian-multimedia.org") ;
+
+ $inst->write_back() ;
+
+=head1 DESCRIPTION
+
+This module provides a configuration model for Approx. Then
+Config::Model provides a graphical editor program for
+F</etc/approx/approx.conf>. See L<config-edit-approx> more help.
+
+This module and Config::Model can also be used from Perl programs to
+modify safely the content of F</etc/approx/approx.conf>.
+
+Once this module is installed, you can run:
+
+ # config-edit-approx
+
+The Perl API is documented in L<Config::Model> and mostly in
+L<Config::Model::Node>.
+
+=head1 Functions
+
+These functions are declared in Approx configuration models and are
+called back.
+
+=head2 read (object => approx_root>, io_handle => ...)
+
+Read F<approx.conf> and load the data in the C<approx_root>
+configuration tree.
+
+=head2 write (object => approx_root>, io_handle => ...)
+
+Write data from the C<approx_root> configuration tree into
+F<approx.conf>.
+
+=head1 AUTHOR
+
+Dominique Dumont, (ddumont at cpan dot org)
+
+=head1 LICENSE
+
+   Copyright (c) 2009 Dominique Dumont.
+
+   This file is part of Config-Model-Approx.
+
+   Config-Model-Approx is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser Public License as
+   published by the Free Software Foundation; either version 2.1 of
+   the License, or (at your option) any later version.
+
+   Config-Xorg 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
+   Lesser Public License for more details.
+
+   You should have received a copy of the GNU Lesser Public License
+   along with Config-Model; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+
+=head1 SEE ALSO
+
+L<config-edit-approx>, L<Config::Model>,

Added: branches/upstream/libconfig-model-approx-perl/current/lib/Config/Model/models/Approx.pl
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-model-approx-perl/current/lib/Config/Model/models/Approx.pl?rev=44929&op=file
==============================================================================
--- branches/upstream/libconfig-model-approx-perl/current/lib/Config/Model/models/Approx.pl (added)
+++ branches/upstream/libconfig-model-approx-perl/current/lib/Config/Model/models/Approx.pl Sun Sep 27 16:34:36 2009
@@ -1,0 +1,107 @@
+[
+          {
+            'read_config' => [
+                               {
+                                 'file' => 'approx.conf',
+                                 'backend' => 'custom',
+                                 'class' => 'Config::Model::Approx',
+                                 'config_dir' => '/etc/approx'
+                               }
+                             ],
+            'name' => 'Approx',
+            'element' => [
+                           'max_rate',
+                           {
+                             'value_type' => 'uniline',
+                             'summary' => 'maximum download rate from remote repositories',
+                             'type' => 'leaf',
+                             'description' => "Specifies the maximum download rate from remote repositories, in bytes per second (default: unlimited). The value may be suf\x{2010} fixed with \"K\", \"M\", or \"G\" to indicate kilobytes, megabytes, or gigabytes per second, respectively."
+                           },
+                           'max_redirects',
+                           {
+                             'value_type' => 'integer',
+                             'summary' => 'maximum number of HTTP redirections',
+                             'upstream_default' => '5',
+                             'type' => 'leaf',
+                             'description' => 'Specifies the maximum number of HTTP redirections that will be followed when downloading a remote file'
+                           },
+                           'user',
+                           {
+                             'value_type' => 'uniline',
+                             'summary' => 'user that owns the files in the approx cache',
+                             'upstream_default' => 'approx',
+                             'type' => 'leaf'
+                           },
+                           'group',
+                           {
+                             'value_type' => 'uniline',
+                             'summary' => 'group that owns the files in the approx cache',
+                             'upstream_default' => 'approx',
+                             'type' => 'leaf'
+                           },
+                           'syslog',
+                           {
+                             'value_type' => 'uniline',
+                             'summary' => 'syslog(3) facility to use when logging',
+                             'upstream_default' => 'daemon',
+                             'type' => 'leaf'
+                           },
+                           'pdiffs',
+                           {
+                             'value_type' => 'boolean',
+                             'summary' => 'support IndexFile diffs',
+                             'upstream_default' => '1',
+                             'type' => 'leaf'
+                           },
+                           'offline',
+                           {
+                             'value_type' => 'boolean',
+                             'summary' => 'use cached files when offline',
+                             'upstream_default' => '0',
+                             'type' => 'leaf',
+                             'description' => 'Specifies whether to deliver (possibly out-of-date) cached files when they cannot be downloaded from remote repositories'
+                           },
+                           'max_wait',
+                           {
+                             'value_type' => 'integer',
+                             'summary' => 'max wait for concurrent file download',
+                             'upstream_default' => '10',
+                             'type' => 'leaf',
+                             'description' => 'Specifies how many seconds an approx(8) process will wait for a concurrent download of a file to complete, before attempting to download the file itself'
+                           },
+                           'verbose',
+                           {
+                             'value_type' => 'boolean',
+                             'upstream_default' => '0',
+                             'type' => 'leaf',
+                             'description' => 'Specifies whether informational messages should be printed in the log'
+                           },
+                           'debug',
+                           {
+                             'value_type' => 'boolean',
+                             'upstream_default' => '0',
+                             'type' => 'leaf',
+                             'description' => 'Specifies whether debug messages should be printed in the log'
+                           },
+                           'distributions',
+                           {
+                             'level' => 'important',
+                             'cargo' => {
+                                          'value_type' => 'uniline',
+                                          'type' => 'leaf'
+                                        },
+                             'summary' => 'remote repositories',
+                             'type' => 'hash',
+                             'description' => 'The other name/value pairs are used to map distribution names to remote repositories. For example,
+
+  debian     =>   http://ftp.debian.org/debian
+  security   =>   http://security.debian.org/debian-security
+
+Use the distribution name as the key of the hash element and the URL as the value
+',
+                             'index_type' => 'string'
+                           }
+                         ]
+          }
+        ]
+;

Added: branches/upstream/libconfig-model-approx-perl/current/t/approx_config.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-model-approx-perl/current/t/approx_config.t?rev=44929&op=file
==============================================================================
--- branches/upstream/libconfig-model-approx-perl/current/t/approx_config.t (added)
+++ branches/upstream/libconfig-model-approx-perl/current/t/approx_config.t Sun Sep 27 16:34:36 2009
@@ -1,0 +1,89 @@
+# -*- cperl -*-
+# $Author: ddumont $
+# $Date: 2008-04-15 13:57:49 +0200 (mar, 15 avr 2008) $
+# $Revision: 608 $
+
+use ExtUtils::testlib;
+use Test::More tests => 4;
+use Config::Model ;
+use Log::Log4perl qw(:easy) ;
+use File::Path ;
+
+use warnings;
+
+use strict;
+
+my $arg = shift || '';
+
+my ($log,$show) = (0) x 2 ;
+
+my $trace = $arg =~ /t/ ? 1 : 0 ;
+$::verbose          = 1 if $arg =~ /v/;
+$::debug            = 1 if $arg =~ /d/;
+$log                = 1 if $arg =~ /l/;
+$show               = 1 if $arg =~ /s/;
+
+Log::Log4perl->easy_init($log ? $TRACE: $WARN);
+
+my $model = Config::Model -> new ( ) ;
+
+Config::Model::Exception::Any->Trace(1) if $arg =~ /e/;
+
+ok(1,"compiled");
+
+# pseudo root where config files are written by config-model
+my $wr_root = 'wr_test';
+
+my $testdir = 'approx_test' ;
+
+# cleanup before tests
+rmtree($wr_root);
+
+my @orig = <DATA> ;
+
+my $wr_dir = $wr_root.'/'.$testdir ;
+mkpath($wr_dir.'/etc/approx', { mode => 0755 }) 
+  || die "can't mkpath: $!";
+open(CONF,"> $wr_dir/etc/approx/approx.conf")
+  || die "can't open file: $!";
+print CONF @orig ;
+close CONF ;
+
+my $inst = $model->instance (root_class_name   => 'Approx',
+			     instance_name     => 'approx_instance',
+			     root_dir          => $wr_dir,
+			    );
+my $approx_conf = "$wr_dir/etc/approx/approx.conf";
+ok($inst,"Read $approx_conf and created instance") ;
+
+my $cfg = $inst -> config_root ;
+
+my $dump =  $cfg->dump_tree ();
+print $dump if $trace ;
+
+my $expect = 'max_rate=100K
+verbose=1
+distributions:debian=http://ftp.debian.org/debian
+distributions:security=http://security.debian.org/debian-security -
+';
+
+is ($dump,$expect,"check data read from approx.conf") ;
+
+$cfg->load("max_rate=200K") ;
+
+$inst->write_back ;
+
+open(APPROX,$approx_conf) || die "Can't open $approx_conf:$!" ;
+my $approxlines = join('',<APPROX>) ;
+close APPROX;
+
+like($approxlines,qr/200K/,"checked written approx file") ;
+
+__END__
+
+
+$max_rate 100K
+$verbose  1
+
+debian          http://ftp.debian.org/debian
+security        http://security.debian.org/debian-security

Added: branches/upstream/libconfig-model-approx-perl/current/t/pod.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-model-approx-perl/current/t/pod.t?rev=44929&op=file
==============================================================================
--- branches/upstream/libconfig-model-approx-perl/current/t/pod.t (added)
+++ branches/upstream/libconfig-model-approx-perl/current/t/pod.t Sun Sep 27 16:34:36 2009
@@ -1,0 +1,8 @@
+# -*- cperl -*-
+
+use strict;
+use Test::More;
+eval "use Test::Pod 1.00";
+plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;
+my @poddirs = qw( lib config-model-edit );
+all_pod_files_ok( all_pod_files( @poddirs ) );




More information about the Pkg-perl-cvs-commits mailing list