On Tue, 2 May 2000, Tobias Hoellrich wrote:
> for a future project I'm in the need to support two different ways how our
> web based service can be accessed:
> 1.) The traditional way: Handling user requests through a browser
> 2.) The "headless" way: Handling under-the-hood requests which basically
> perform the same service as in 1, but without ever generating valid HTML.
I think that whay you want, contrary (and/or supplementary) to what some
other people suggested, is to start by writing an API. This API should do
everything _but_ handle the interface. This means it takes care of the
database, business logic, report generation (in the form of data
structures), etc.
Then you write two interfaces against the API. One is an HTML based
interface (which you could do with any of the wonderful perl embedding
tools available. My personal preference is Mason). The other interface
might be a set of command line executables (which can be run from cron) or
an actually shell interface, or curses, or whatever.
This is exactly the approach I've taken with my Alzabo project (a data
modelling tool). I started by writing an API of objects that encapsulate
all of the logic of representing the schema. Then I used Mason to develop
an HTML interface which instantiates objects and shows them to you, as
well as giving you forms to change them. I plan to also write a curses
based interface. Eventually, if I have the tuits I'll be able to develop
a slick GUI (Gtk? Tk? Qt? All of the above?) against the same API, without
changing the core logic (except to add new features).
-dave
/*==================
www.urth.org
We await the New Sun
==================*/