Perl Apprenticeship Site

来自开放百科 - 灰狐
2013年2月14日 (四) 10:41Allen (讨论 | 贡献)的版本

(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转到: 导航, 搜索

http://apprentice.perl.org/

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.

wget http://search.cpan.org/CPAN/authors/id/K/KW/KWILLIAMS/Module-Build-0.2806.tar.gz

Start the installation with the following command:

perl Build.PL
./Build
./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.

wget http://www.masonbook.com/source/Apprentice-0.19.tar.gz
perl Build.PL
vi insert_dummy_data.pl
vi /usr/lib/perl/5.8/Apprentice/Data.pm
DB_NAME, DB_USER

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
</Location>

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 "apprentice.perl.org" as a domain. You will need to change this if you want to run the code on your own system.

分享您的观点
个人工具
名字空间

变换
操作
导航
工具箱