To refresh my Perl skills, I wrote a web server in Perl. I called it as ‘Camel Server’. Camel Server has following features:
- Support HTTP GET/POST/HEAD methods.
- Support multi-processes.
- Support any static text pages.
- Support PERL files execution.
- Support default pages.
- Support Form & CGI parameters.
- Support XML configuration.
- Support Authentication & Session management page per page.
- Certified by Perl Testing framework (of course it is not bug-free!)
You can refer to its README file for more details. https://github.com/luohuahuang/Camel/blob/master/README.md
In this page, I will introduce Camel’s filesystem and recipes.
bin – it contains script to start Camel Server.
conf – it contains .xml configuration files to configure authentication and server setting.
lib – it is the core component of Camel.
camelauth.pm – for authentication
camelcgi.pm – for CGI & parameters pass
camelhttp.pm – main module. Server will be started here and listen/receive requests
camellogger.pm – utility to log logs
camelutils.pm – utility subroutines
camelxml.pm – XML engine. It takes care of XML interactive.
t – it contains testing cases
temp – it is a temporary working directory. Camel requires temp directory to handle .pl execution.
webapps – the root directory of apps.
firstapp – it is a demo apps.
manager – it is the administrator apps shipped with Camel Server. You can not delete it. Currently it has only one page named as login_portal.pl. It is the core .pl page to implement Authentication. In future releasing, I will add more utility pages under manager directory.
logs – it contains the logs file logged by camellogger.pm
The followings are my posts about Camel Server. You might find some useful recipes.
- Socket: http://luohuahuang.com/2013/08/04/perl-in-socket/
- HTTP::Daemon: http://luohuahuang.com/2013/08/05/httpdaemon-in-perl/
- CGI Engine: http://luohuahuang.com/2013/08/05/tricky-way-to-instantiate-a-class-in-perl/
- Form: http://luohuahuang.com/2013/08/06/form-content-enctype/
- XML Engine: http://luohuahuang.com/2013/08/07/parsing-xml-in-perl/
- Testing: http://luohuahuang.com/2013/08/08/perl-testing/
- Authentication: http://luohuahuang.com/2013/08/12/auth-mechanism-in-camel/