App-Office-Contacts
view release on metacpan or search on metacpan
lib/App/Office/Contacts.pm view on Meta::CPAN
the config file using L<File::ShareDir>, to a directory where the run-time code in
L<App::Office::Contacts> will look for it.
shell>cd App-Office-Contacts-1.00
shell>perl scripts/copy.config.pl
shell>perl scripts/find.config.pl
Alternately, edit the installed copy rather than the copy shipped with the distro.
=head3 Install the FAQ web page
In C<share/.htoffice.contacts.conf> there is a line:
program_faq_url = /assets/templates/app/office/contacts/faq.html
This page is displayed when the user clicks FAQ on the About tab.
A sample page is shipped in C<htdocs/assets/templates/app/office/contacts/faq.html>.
So, copying the C<htdocs/assets/> directory, as above, will have installed this file.
Alternately, replace it with your own.
As always after editing the config file, run:
shell> perl scripts/copy.config.pl
shell> perl scripts/find.config.pl (as a cross-check)
Alternately, edit the installed copy rather than the copy shipped with the distro.
=head3 Install the trivial CGI script and the Plack script
Copy the C<httpd/cgi-bin/office/> directory to the C<cgi-bin/> directory of your web server,
and make I<contacts.cgi> executable.
My C<cgi-bin/> dir is C</usr/lib/cgi-bin/>, so I end up with C</usr/lib/cgi-bin/office/contacts.cgi>.
Now I can run C<http://127.0.0.1/cgi-bin/office/contacts.cgi> (but not yet!).
=head3 Creating and populating the database
The distro contains a set of text files which are used to populate constant tables.
All such data is in the data/ directory.
This data is loaded into the 'contacts' database using programs in the distro.
All such programs are in the scripts/ directory.
After unpacking the distro, create and populate the database:
shell>cd App-Office-Contacts-1.00
# Naturally, you only drop /pre-existing/ tables :-),
# so use drop.tables.pl later, when re-building the db.
#shell>perl -Ilib scripts/drop.tables.pl -v
shell>perl -Ilib scripts/create.tables.pl -v
shell>perl -Ilib scripts/populate.tables.pl -v
shell>perl -Ilib scripts/populate.fake.data.pl -v
Notes:
=over 4
=item If using -Ilib, Perl looks in the current directory structure for the modules
That is, Perl does not use the installed version of the code, if any.
=item The code looks in the shared directory structure for C<.htoffice.contacts.conf>
If you unpack the distro, and run:
shell> perl scripts/copy.config.pl
shell> perl scripts/find.config.pl (as a cross-check)
it will copy the config file to the install dir, and report where it is.
Alternately, edit the installed copy rather than the copy shipped with the distro.
=back
So, if you leave out the '-Ilib', Perl will use the version of the code which has been
formally installed.
=head3 Start testing
Point your broswer at C<http://127.0.0.1/cgi-bin/contacts.cgi>.
Your first search can then be just 'a', without the quotes.
=head1 Object attributes
=over 4
=item o See the parent module L<CGI::Snapp>
=back
=head1 Methods
=head2 build_about_html($user_id)
Creates a HTML table for the About tab.
Note: The code does not currently use $user_id. It is present as provision if the code is patched to
identify logged-on users. See the L</FAQ> for a discussion of this issue.
=head2 build_web_page()
Creates the basic web page in response to the very first request from the user.
=head2 global_prerun()
Contains code shared by this module and L<App::Office::Contacts::Donations>.
=head2 teardown()
Shuts down database connexions, etc, as the program is exiting.
=head1 FAQ
=head2 How do I delete an organization or person?
Search for them, and then set their visibility to No-one. Hence they stay in the database but are no
longer visible.
=head2 Is utf8 supported in V 2.00?
Yes. L<Text::CSV::Encoded> is used in C<App::Office::Contacts::Util::Import> to read data/fake.people.txt.
( run in 3.075 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )