mvhub-dev team mailing list archive
-
mvhub-dev team
-
Mailing list archive
-
Message #00125
[Branch ~mvhub-commit/mvhub/trunk] Rev 371: merged add_pod_for_utils_configsimple
Merge authors:
Dan MacNeil (omacneil)
Related merge proposals:
https://code.launchpad.net/~omacneil/mvhub/add_pod_for_utils_configsimple/+merge/24180
proposed by: Dan MacNeil (omacneil)
review: Approve - Lee Goodrich (leegoodrich)
------------------------------------------------------------
revno: 371 [merge]
committer: Dan MacNeil <dan@xxxxxxxxxx>
branch nick: trunk
timestamp: Wed 2010-04-28 11:21:26 -0400
message:
merged add_pod_for_utils_configsimple
modified:
lib-mvhub/lib/MVHub/Utils/ConfigSimple.pm
--
lp:mvhub
https://code.launchpad.net/~mvhub-commit/mvhub/trunk
Your team MVHub Developers is subscribed to branch lp:mvhub.
To unsubscribe from this branch go to https://code.launchpad.net/~mvhub-commit/mvhub/trunk/+edit-subscription
=== modified file 'lib-mvhub/lib/MVHub/Utils/ConfigSimple.pm'
--- lib-mvhub/lib/MVHub/Utils/ConfigSimple.pm 2010-04-18 20:51:33 +0000
+++ lib-mvhub/lib/MVHub/Utils/ConfigSimple.pm 2010-04-26 21:09:07 +0000
@@ -63,10 +63,9 @@
=head1 NAME
-MVHub::Utils - misc utility functions
-
-
-MVHub::Utils A collection of utility sub routines used by MVHub
+MVHub::Utils::ConfigSimple - read constants from our config file
+
+MVHub::Utils::ConfigSimple
=head1 VERSION
@@ -74,16 +73,51 @@
=head1 SYNOPSIS
- use MVHub::Utils;
+ use MVHub::Utils qw/create_config_from /;
+
+ my $cfg=create_config_from($ENV{MV_CONFIG_FILE});
+
+ my $allow_robots=$cfg->param('SITE.allow_robots');
+
+ my $tmp_dir=$cfg->param('ABSOULTE_PATH.tmp_dir');
=head1 DESCRIPTION
-subs used by more than one script
+MVHub::Utils::ConfigSimple is a wrapper to Config::Simple
+that exports single function create_config_from , that takes
+a config filename and returns a Config::Simple object
+
+Our wrapper allows us to calculate paths and store them
+as unique pieces in the config file.
+
+[BASE].dir and [RELATIVE_PATH] are stored in the
+config file.
+
+Calculated paths which include $ENV{USER} can be retrieved with the [ABSOLUTE_PATH]
+section.
+
+In most cases, you can create the Config Files and
+Config objects as you would a regular Config::Simple
+object.
+
+# in the config file:
+
+[BASE]
+dir=/var/www/mvhub/
+
+[RELATVE_PATH]
+tmp_dir=tmp/
+
+# in Perl
+
+print $cfg->param('ABSOLUTE_PATH.tmp_dir')
+ eq '/var/www/mvhub/$ENV{USER}/tmp/'
=head1 SEE ALSO
- MVHub::Common
-
+ Config::Simple
+ MVHub::CGIAppBase
+
=head1 LAST MODIFIED
Last modified on $Date: 2009-02-27 19:01:34 -0500 (Fri, 27 Feb 2009) $ by $Author: omacneil $