PsPage: a new project for web programming
lazarus / 38-Networking and Web Programming
----------------------------------------------------------------------
nomorelogic · 2013-03-20 08:28
Hi all
I would like to ask your opinion on a small project for web
development.
This project was born from various threads in the forum dedicated to
Italian lazarus and free pascal. Find the thread here, in Italian:
1st thread:
http://www.lazaruspascal.it/index.php?topic=534.0
actual:
http://www.lazaruspascal.it/index.php?topic=542.msg4056 # msg4056
The idea is to develop a module for apache that contains within a
pascal interpreter.
When you have to develop a web project, fortunately for those who love
pascal, there are several alternatives. However, the pascal is a
compiled language, and when the
time comes for the installation, we must decide whether to:
1) make a binary module for an existing web server
2) use CGI (or FastCGI)
3) build a stand-alone web server
When you cannot handle the host server where you want to install the
web
application, these solutions can be an obstacle.
It's clear that in the base of this development system there is a
binary module but, once installed, web development is done with
pascal script (actually, rem objects pascal script).
As it should be.
I'd like to give the ability to write code at 2 different levels:
- Page level style ("page server")
- pascal code
But the 2 levels are however reduced to 1 (pascal code level) with a
page
translation done at design-time.
Looking at code, follow a "hello world" example (saved into apache's
DocumentRoot):
Code: [Select]program test00;
var title: string;
begin
title := 'Testing pspage';
Out_Write( '' +
'
' + title + '' +
'' +
'' + title + '
');
Out_Write('Hello world');
Out_Write('');
end.
Currently, the development is still being tested then the code is
still
unfinished and includes:
- Basis for development through plugins: everything should be a plug-
in to be loaded into memory when the script meets "uses plugin-name;"
- Access to the firebird database through SQLdb (written as a plugin
statically linked)
- Visibility in scripts instances Request and Response
- Some scripts to try including login using ajax
- Tested with apache on linux and windows x64 x32
As it should be like the next step:
- Access to various databases using SQLdb possible (mysql, sqlite,
postgres, mssql, nosql, etc ...)
- Another plugin for accessing database (the candidate is ZEOS)
- Plugin for generating reports
- Make plugin dynamically linkable
- Add example script for each feature present
Waiting for your criticism and advice and, most importantly, I hope
that there is someone interested in the project, which may also give
practical help (unfortunately I do not have much time but I'd like to
take it forward).
svn checkout
http://svn.code.sf.net/p/lazarusiug/liug/trunk/pspage_module
best regards
nomorelogic
----------------------------------------------------------------------
chrnobel · 2013-03-20 10:03
As I see it you are trying to reinvent the wheel.
I am still using Powtils, as it is a real good base for building web
programs, and it is really straight forward.
Choose what ever webserver you like (in practice Apache gives the
least headache).
Compile the program, and run them out of CGI-BIN (or WWW if you allow
execution of CGI).
No problems with memoryhandling etc. as every binary runs just once,
and then is released again - and trust me, it is not a resource hog, I
have made some turned upside-down performance tests, and it really
kicks ass.
And as it is straight forward Free Pascal, there are no problems in
using Zeos.
I know Lars haven't been working on this for quite some time, but that
does not necessarily mean that the work already done cannot be used.
Regards
Christian
----------------------------------------------------------------------
nomorelogic · 2013-03-20 12:18
I also think that powtils is a powerful tool. I also agree that even
though it is a bit of time that is stationary with development is not
a valid reason for not using it.
The intention is to create a tool for development that is not compiled
but based on scripts and does not require anything more to install
than enabling a apache module.
This is to imitate the php language (and maybe later jsp). I think
it's a lack in pascal world.
----------------------------------------------------------------------
xinyiman · 2013-03-20 14:37
Here I am, I must say that I already knew the project and I must say
that from what I know there is still nothing like it. Because until
now I have not seen anything similar to php but with pascal syntax.
----------------------------------------------------------------------
Leledumbo · 2013-03-20 16:18
How would it differ from Delphi Web Script?
----------------------------------------------------------------------
nomorelogic · 2013-03-20 17:57
Delphi Web Script currently run on windows and this is a limit (at
least until Delphi will not compile for linux).
As in DWS FAQ, Free Pascal is not directly supported, in the meantime,
you could compile with fpc but this depends on how fpc can support the
features of Delphi compiler.
I like fpc and linux and IMHO, if I start a web project I'd like to
think I do not have these limitations.
Edit:
I don't know if DWS allows the development of plug-ins or dll in order
to extend scripting capabilities. In any case if fpc is not directly
supported, to develop extensions will be necessary to use delphi.
----------------------------------------------------------------------
Leledumbo · 2013-03-20 22:23
QuoteDelphi Web Script currently run on windows and this is a limit
(at least until Delphi will not compile for linux).I remember someone
posting that DWS 2.3 (development) is already FPC compatible (perhaps
the poster manages to supply a patch that makes it possible).
----------------------------------------------------------------------
nomorelogic · 2013-03-21 09:18
I did not know this thing.
When I had to choose the script engine I've dropped DWS because, from
what I read on their website, was a project made with delphi for
windows. With support and the possibility of porting to fpc - it is
true - but in the end I chose Pascal Script (Rem Objects) because
already ported to fpc and ready to use.
It's still a good news. Pascal Script is mature but it seems that
development has slowed down as well as support. I hope to see soon DWS
2.3 (preview 2 is ready) in order to valuate it. Also because the
"Web" in the name leaves me hopeful.
On the web server side, I saw that they also have a project: DWS's Web
Server.
http://code.google.com/p/dwscript/wiki/WebServer
Is a server Quotebased on http.sys 2.0 and requires under Windows
2008, Vista or above.
In my case, as already mentioned, are interested in making a module
for apache (but also a command line ). At first I would support
scripting as programming in cgi mode. At this stage I would expand the
potential to use and experiment with the use of databases, plugins,
fpc templates, js, jquery, qooxdoo, etc. (yes, need javascript code at
this time).
In a second step would embed tag "" to allow the use of advanced
frameworks as ExtJs, ExtPascal, own-designed-framework, etc.
Edit:
forgive my english