mvhub-dev team mailing list archive
-
mvhub-dev team
-
Mailing list archive
-
Message #00241
[Merge] lp:~omacneil/mvhub/improve_POD_CgiAppBase into lp:mvhub
Dan MacNeil has proposed merging lp:~omacneil/mvhub/improve_POD_CgiAppBase into lp:mvhub.
Requested reviews:
MVHub devs with commit rights (mvhub-commit)
improved POD for MVHub::CGIAppBase and MVHub::Utils::ConfigSimple
--
https://code.launchpad.net/~omacneil/mvhub/improve_POD_CgiAppBase/+merge/26632
Your team MVHub Developers is subscribed to branch lp:mvhub.
=== modified file 'README'
--- README 2010-01-13 01:08:19 +0000
+++ README 2010-06-02 19:35:35 +0000
@@ -50,7 +50,8 @@
To read POD:
- perldoc lib-mvhub/lib/MVHub
+ perldoc MVHub::CGIAppBase
+ perldoc MVHub::Utils::ConfigSimple
The rest of the docs are in:
=== modified file 'lib-mvhub/lib/MVHub/CGIAppBase.pm'
--- lib-mvhub/lib/MVHub/CGIAppBase.pm 2009-12-18 04:24:44 +0000
+++ lib-mvhub/lib/MVHub/CGIAppBase.pm 2010-06-02 19:35:35 +0000
@@ -148,29 +148,67 @@
=head1 SYNOPSIS
use base CGIAppBase;
-
+
+ sub a_run_method {
+ my $self = shift;
+
+ my $dbh = $self->dbh();
+ my $sql = $self->retr_select_sql('AGENCY_X_ALL');
+ my $tmp_dir =$self->get_config_param('ABSOULTE_PATH.tmp_dir');
+ my $stuff_aref = $dbh->selectcol_arrayref($sql);
+ #...
+ }
+
=head1 DESCRIPTION
- There are no public methods.
+ MVHub::CGIAppBase is the class all our other classes should inherit
+ from. It contains methods for getting the object's database handle,
+ the variables contained in the configuration file and the SQL
+ statements stored in app-mvhub/conf/sql_select.lib
+
+=head1 METHODS
+
+ dbh()
+
+ returns a database handle
+
+
+ get_config_param($PARAM_NAME)
+
+ Given the name of a paramter, returns the value stored in the
+ application config file.
+
+ The application configuration file
+ is currently either /var/www/mvhub/$USER/conf/mvh.conf or
+ /var/www/mvhub/$USER/conf/nsp.conf (though you should not
+ depend on these files remaining in these places.
+
+ retr_select_sql($SQL_STATEMENT_NAME)
+
+ Given the name of a sql SELECT statement, returns the SQL for that
+ statement. Currently the file the SQL statements are stored in
+ is: app-mvhub/conf/sql_select.lib, though you should not depend
+ on this location. ---And you should need to depend on a hard coded
+ path as this is handled internally for you by CGIAppBase.
=head1 SEE ALSO
+ # Particularly, cgiapp_init
man CGI::Application
- Particularly, cgiapp_init
-
man CGI::Application::Plugin::DBD
- man CGI::Application::Plugin::Config::Simple
-
+ perldoc MVHub::Utils::ConfigSimple
+ man SQL::Library
+
=head1 LAST MODIFIED
-Last modified on $Date: 2009-02-25 22:11:05 -0500 (Wed, 25 Feb 2009) $ by $Author: omacneil $
+Last modified on $Date: 2010-06-02 22:11:05 $ by $Author: omacneil $
=head1 BUGS
-CGIAppBase is used by AgencyAccount.pm and (the emerging) AgencyRecord.pm
-
-CGIAppBase is not used by DataEntryAccount.pm, Guide.pm so these modules all have duplicate code
+CGIAppBase is used by AgencyAccount.pm and Guide.pm but not other
+classes. Much of the code, agency_form.pl and program.pl in particular
+don't use CGI::Application as they are entirely procedural.
=head1 LICENSE
=== modified file 'lib-mvhub/lib/MVHub/Utils/ConfigSimple.pm'
--- lib-mvhub/lib/MVHub/Utils/ConfigSimple.pm 2010-05-20 18:03:55 +0000
+++ lib-mvhub/lib/MVHub/Utils/ConfigSimple.pm 2010-06-02 19:35:35 +0000
@@ -90,8 +90,9 @@
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.
+You can then use the various Config::Simple methods, in
+particular: param(); to get configuration parameters/
+CONSTANTS.
[BASE].dir and [RELATIVE_PATH] are stored in the
config file.
@@ -116,6 +117,19 @@
print $cfg->param('ABSOLUTE_PATH.tmp_dir')
eq '/var/www/mvhub/$ENV{USER}/tmp/'
+The application configuration file
+is currently either /var/www/mvhub/$USER/conf/mvh.conf or
+/var/www/mvhub/$USER/conf/nsp.conf (though you should NOT
+depend on these files remaining in these places.
+
+A better practice for getting the name of the config file
+is the enviroment variable $ENV{MV_CONFIG_FILE}. which is set
+in the development shell enviroment with the 'cdw' alias
+and in the web server in the apache configuration file.
+
+Our wrapper allows us to calculate paths and store them
+as unique pieces in the config file.
+
=head1 SEE ALSO
Config::Simple
@@ -164,5 +178,3 @@
=head1 INCOMPATIBILITIES
No known incompatibilities
-
-
Follow ups