Perl Apprenticeship Site

来自开放百科 - 灰狐
跳转到: 导航, 搜索

The installation of the Perl Apprentice site involves several steps.

You will need Apache with mod_perl installed, as well as the MySQL DBMS installed and running.

Obviously, you will need Mason, at least version 1.10. The latest 1.1x or 1.2x version is strongly recommended. This site will not work with 1.0x or earlier.

Additionally, you will need the following Perl modules:

  • Apache::Request 0.33+ # apt-get install libapache-request-perl
  • Digest::SHA1 #
  • Email::Valid
  • HTML::FromText
  • Lingua::EN::Inflect # apt-get install liblingua-en-inflect-perl
  • MIME::Lite
  • Time::Piece 1.0+
  • URI and URI::Escape (both in the URI distribution)

The site is coded in a way that assumes that your component root and document root are the same. The site will not work properly if this is not the case.

The installation itself requires that you install Module::Build.


Start the installation with the following command:

perl Build.PL
./Build test
./Build install  (this step may need to be done as the superuser)
Writing /usr/local/lib/perl/5.8.4/auto/Module/Build/.packlist  

This will install the site's Mason components and Perl modules,, and it will set up the database instance used by the site.

perl Build.PL
vi /usr/lib/perl/5.8/Apprentice/

The second and final step is to configure Apache. Assuming that this is a fresh Apache install, with a document root of /var/www, the needed Mason configuration looks like this:

PerlModule  Apprentice
PerlSetVar  MasonDataDir  /path/to/data/dir   # this can be any directory you like
PerlSetVar  MasonArgsMethod  mod_perl
PerlSetVar  MasonAllowGlobals  $Schema
PerlAddVar  MasonAllowGlobals  $User
<Location /var/www>
  SetHandler   perl-script
  PerlHandler  HTML::Mason::ApacheHandler

Once this has been added, restart the Apache server. You should now be able to view the Perl Apprentice site through your Apache server.

A single, admin level, account has been created. The user name for this account is "admin" and the password is "fayewong".

The htdocs/lib/set_login_cookie.mas and htdocs/users/logout.html components specifies "" as a domain. You will need to change this if you want to run the code on your own system.