| 1 |
CGI::XMLApplication |
| 2 |
|
| 3 |
How To Install? |
| 4 |
|
| 5 |
The installation should be perlish |
| 6 |
|
| 7 |
perl Makefile.PL |
| 8 |
make |
| 9 |
make test |
| 10 |
make install |
| 11 |
|
| 12 |
CGI::XMLApplication requires the XML::LibXML and XML::LibXSLT module. |
| 13 |
Both modules are available on CPAN. |
| 14 |
|
| 15 |
What is CGI::XMLApplication? |
| 16 |
|
| 17 |
Perl modules to implement OO CGI-Scripts with XML capabilities in |
| 18 |
Perl similar to CGI::Application. It is not related to CGI::XML |
| 19 |
(than it would be CGI::XML::Application) and does share its features. |
| 20 |
|
| 21 |
CGI::XMLApplication is not a simple addon to CGI.pm! I think there |
| 22 |
is no simple and fast way to convert existing CGI scripts. This is |
| 23 |
basicly because of the gap of main concepts and paradigmata between |
| 24 |
CGI.pm and CGI::XMLApplication, although CGI.pm is the SUPER class of |
| 25 |
CGI::XMLApplication. |
| 26 |
|
| 27 |
Why is there so much broken english? |
| 28 |
|
| 29 |
The original code and documentation has been writtin in 2003/4 and |
| 30 |
the documentation shows my poor English back then. |
| 31 |
If you find the documentation offending to the English language, please |
| 32 |
nudge me via RT.cpan.org and ask me to improve a particular section. I |
| 33 |
will see to it that I will improve the documentation. An even |
| 34 |
better approach is to create a pull-request on github that corrects the language. |
| 35 |
|
| 36 |
Behind the scene. |
| 37 |
|
| 38 |
While most CGI-Scripts are embedded into larger web based applications |
| 39 |
the scripts themselves usually do not represent this fact. The |
| 40 |
evolutionary grown mosaic of an traditional CGI-Script assembly style |
| 41 |
application cannot easily be extended with certain features, relevant |
| 42 |
to the application in general. |
| 43 |
|
| 44 |
CGI::XMLApplication is an application framework to implement |
| 45 |
CGI-Scripts in Perl without the overhead of a complete Perl |
| 46 |
application. The framework should hide most of the important, but |
| 47 |
redundant code of a Perl CGI-Application shared by several |
| 48 |
scripts. Since CGI.pm is a very powerfull module to implement CGI |
| 49 |
scripts it is used as a super class of CGI::XMLApplication. This |
| 50 |
should make the implementation of new scripts usinge this class easy, |
| 51 |
since the whole Interface of CGI.pm is still available. There are some |
| 52 |
conceptual changes, basicly related to the response that reflect |
| 53 |
concepts of XML/XSLT. This has the effect, that most output functions |
| 54 |
of CGI.pm are not very usefull if used from this class ;) |
| 55 |
|
| 56 |
The module have especially been written to enable Perl newbees to |
| 57 |
write full featured CGI-Scripts and CGI applications. To make things |
| 58 |
more easier readable for people, the CGI:OO module forces the |
| 59 |
programmer to implement the application rather problem-orientated than |
| 60 |
programm-code-orientated. |
| 61 |
|
| 62 |
Using such concepts makes it much easier for people, who want to |
| 63 |
understand the code -- and usually they are forced to --, to follow |
| 64 |
the structure of the application. In larger software projects this is |
| 65 |
a very important aspect. |
| 66 |
|
| 67 |
Using the object and problem orientated application programming |
| 68 |
paradigma makes it possible to develop a certain (web based) |
| 69 |
application aloing its structure, not along the restraints of its |
| 70 |
primary programming language. The CGI::XMLApplication concept opens the |
| 71 |
possiblity to port the application to another programming language |
| 72 |
(like C++ or Java) more easily. This aspect is quite important if a |
| 73 |
port has to be done -- be it for performance or any other reasons. |
| 74 |
|
| 75 |
Why should I use it? |
| 76 |
|
| 77 |
If you are planning to implement a single script CGI application, that |
| 78 |
should do a very simple job, CGI::XMLApplication is probably not what |
| 79 |
you are looking for. More commonly Netslaves like us are forced to |
| 80 |
implement fully grown web based applications consisting of a set of |
| 81 |
more or less isolated CGI-Scripts. Each script having a default |
| 82 |
behaviour, for example doing something after an event like a button |
| 83 |
being pushed or a link beeing followed by the client. If you know a |
| 84 |
little about CGI-Scripts, you may already have recognized that scripts |
| 85 |
look amazingly similar in their principal function-set. Most of the |
| 86 |
scripts may have quite similar implementations of the same basic |
| 87 |
requirements they should fulfill. That being a potential source for |
| 88 |
redundancy and painful hours debugging. This is there |
| 89 |
CGI::XMLApplication comes in -- a problem oriented application |
| 90 |
framework to avoid redundancies and to facilitate easier portabilty of |
| 91 |
Perl based CGI applications. |
| 92 |
|
| 93 |
Where is the difference to CGI::Application? |
| 94 |
|
| 95 |
This question is quite important, since CGI::Application was discussed |
| 96 |
on the Web a lot at the time I wrote this module. The main difference |
| 97 |
I see, is that CGI::XMLApplication includes the XML paradigma of |
| 98 |
dispairing data and datapresentation. |
| 99 |
|
| 100 |
The second major difference is, that a perl programmer does not have |
| 101 |
that much freedom on the programm structure. Yes, CGI::XMLApplication |
| 102 |
is rather strict for perl standards. I realized in my daily work that |
| 103 |
this freedom causes a lot of problems in midsize or large web-based |
| 104 |
applications. |
| 105 |
|
| 106 |
The less obvious difference is how the data presentation is |
| 107 |
done. While CGI::Application uses the "propritary" perl format for |
| 108 |
data presentation, CGI::XMLApplication uses by default XML and XSLT, |
| 109 |
which are standardised. This leaves the oportunity to change the |
| 110 |
programm code and even the programming language, but leaves the data |
| 111 |
model untouched. New output formats can be added without changing |
| 112 |
the entire code. |
| 113 |
|
| 114 |
Old-school CGI scripts will have most allways quite a lot print calls |
| 115 |
(or at least some thing similar). All these calls are related to the |
| 116 |
field of data persentation, usually a job done by designers or HTML |
| 117 |
programmers. Both modules CGI.pm and CGI::Application include such |
| 118 |
formating functions. A perl coder using CGI::XMLApplication does not |
| 119 |
need to bother about the data a client will finally see. Therefore, |
| 120 |
formated output calls as they are used in CGI.pm and CGI::Application |
| 121 |
doesn't make much sense with CGI::XMLApplication. Presenting data is |
| 122 |
handled via XSLT Stylesheets. The script has to care only about the |
| 123 |
data, which should be kept in a XML-DOM. So a script programmer |
| 124 |
can pass data to a stylesheet and does not care about the output |
| 125 |
anymore. |
| 126 |
|
| 127 |
As well CGI::XMLApplication implements a stricter application |
| 128 |
structure, than CGI::Application. CGI::XMLApplication handles script |
| 129 |
initialization, functionality, cleanup and data output is strictly |
| 130 |
separated parts of the script. |
| 131 |
|
| 132 |
Code repository |
| 133 |
|
| 134 |
I moved the code to GITHUB with Version 1.1.4. Please, make a pull request |
| 135 |
if you suggest changes to the code or the documentation. |
| 136 |
|
| 137 |
The code is available here: |
| 138 |
|
| 139 |
https://github.com/phish108/CGI-XMLApplication |
| 140 |
|
| 141 |
Contributors |
| 142 |
|
| 143 |
CGI::XMLApplication includes contributions of the following developers. |
| 144 |
|
| 145 |
* Michael Kröll |
| 146 |
* Kip Hampton |
| 147 |
* Gregor Herrmann |
| 148 |
* Lucas Kanashiro |