Chapter 52. Execise: create a new program

Table of Contents
Case study: create a fmlsch
Case study: fmlsch.cgi

Consider creation of a simple scheduler listing tool in the fml8 framework. Here the program name is "fmlsch" and the cgi is "fmlsch.cgi".

Case study: create a fmlsch

Step 1: add fmlsch into installer configuration

Prepare fml/bin/fmlsch.in, add fmlsch into $bin_programs in fml/etc/install.cf.in. Run configreu to re-create fml/etc/install.cf.

Step 2: build a module

Write fml/lib/FML/Demo/Calendar.pm as the main library of fmlsch.

Import other libraries if needed. For fmlsch we import HTML-CalendarMonthSimple-1.02.tar.gz from CPAN.

Also, install Date-Calc if your system has not it.

Step 3: modify FML::Process:: class

FML::Demo::Calendar works mainly but we build the machanism how fml8 loads and runs it. We modify FML::Process class for fml8 bootloader to call FML::Demo::Calendar.

Firstly, write mandatory methods for fmlsch process in fml/lib/FML/Process/Calender.pm. You need to create this file.

Secondly, set up boot loader configuration. In the case of fmlsch, the bootloader loads FML::Process::Calender. Define it in fml/etc/modules. Set up fml/etc/command_line_options properly. This "command_line_options" file has a map between a command and the command line options parsed by Getopt::Long().

Create FML::Process::Calender module by copy-and-pasting other FML::Process:: modules :-) However fmlsch has only to contain least functions, you need to write FML::Process::Calender::run() method. For undefined methods, fml loads FML::Process::Kernel functions (inheritence).

fml 8.0 (fml-devel) project homepage is www.fml.org/software/fml8/.
fml 4.0 project homepage is www.fml.org/fml/menu.ja.html.
about one floppy bsd routers, see www.bsdrouter.org/.
other free softwares are found at www.fml.org/software/.

author's homepage is www.fml.org/home/fukachan/.
Also, visit nuinui's world :) at www.nuinui.net.

For questions about FML, e-mail <fml-bugs@fml.org>.