Template or XML?

2001-09-14 Thread Alexandr Efimov

Hello, All!

>Yes. AxKit's XSP module does this. Your SQL can be generated with the
>AxKit::XSP::ESQL module, and then you can loop over the results
>in your XSLT stylesheet using either xsl:foreach or (better still)
> using a template.

Actually using AxKit::XSP::ESQL module seems to be much
more complicated compared to calling a function in Template Toolkit,
for example, it is inconvenient to write code like this:
--

  Sybase
  database=mydb
  matt
  millionaire

  SELECT MessageId, Subject FROM Messages

-
in Template, it would be something like
[% data=fetch({sql=>"SELECT MessageId, Subject FROM Messages"}) %]
and we can connect to database only once, probably before
processing a Template. Also, logic seems to be easier to implement
with Template than with AxKit.

So, we tried to set up Apache so that files will be processed
with Template Toolkit first, and the result will be an XML
to be processed by AxKit. But that didn't work,
with the following error message in log:

Can't locate object method "filter_register" via package "Apache" at 
/usr/local/lib/site_perl/Apache/RegistryFilter.pm line 13.


How can I configure Apache so that Template output
will be processed by AxKit?

We have also heard something about OpenInteract, which is based on
Template Toolkit - may be it would be simplier to use it?

-
Best regards,
Alexander Efimov.
programmer of WebZavod
(http://www.webzavod.ru)





Template or XML?

2001-09-14 Thread Alexandr Efimov

Hello, all!

We have a 4 year experience in developing web sites
for our customers. Most of these web sites must present
information stored in some relational database
(MySQL or Oracle), and we create a special web interface
for managing the data stored in the database.
We cannot use standard modules like DB::Editor,
because we need to provide a simple and easy-to-use
interface for end user.

We used to create such interface using Apache::ASP,
but that was incovenient because we could not
reuse code for different projects, and it required a programmer
and a usability specialist to work togather on such interface
which took up to 70% of the entire project.
Now we use Template Toolkit 2, it is more convenient
as we can define templates with common objects.
Some of these objects perform tasks related to database,
for example, updating or fetching data from the database,
other kind of objects are those that define
presentation of the document. So, we can reuse such objects,
but it is not very convenient. The main template
mostly consists of a lot of [% INCLUDE ... %] statements,
and we want to use some simplier syntax for this, like XML.

We tried to use XML, but the main problem with XML
is that we cannot insert even a simple logic constructions,
like IF of FOREACH, as with Template.

At this time, for this configuration file we use
a special XML-like syntax (it is not really an XML,
it is translated into TT2 with a our parser).
Here is an example of such page:


























--
which is actually translated into
[% PROCESS autorization_check %]
[% mysql_connect({database=>"musica"}) %]
etc...

Our questions are:
1. Are there any mod-perl packages created for similar tasks?
2. Can constructions similar to

...


(which is now translated into [% FOREACH ... %] template blocks)
be implemented with standard XML parser?

-
Best regards,
Alexander Efimov.
programmer of WebZavod
(http://www.webzavod.ru)





IPC::SharedCache - problem

2001-01-17 Thread Alexandr Efimov

Hi,

I'm having a problem with IPC::SharedCache module:
when executing a code like this:
tie(%cache, 'IPC::SharedCache',load_callback => sub {return undef},
 validate_callback => sub {return 1},ipc_key => 'hash');
for ($i=1;$i<=1000;$i++) {
$cache{"key_$i"}=[$i];
}
it allocates a separate memory segment and a separate
semaphore for each cache record, thus exceeding system limit
on the number of semaphores and shared memory segments.
Is there any way to change that behaviour, in other
words, to allocate an entire hash in only one shared memory
segment?

Alexander