RE: Templating System

2000-07-27 Thread Darko Krizic

> Darko Krizic <[EMAIL PROTECTED]> wrote:
> > ... 
> > 
> >   
> >   Name
> >   Count
> >   
> >   example name
> >   example count
> >   
> > 
> > ...
> > The problem with many templating systems is the fact that 
> they invent a new
> > language like "$variable" which is usually not 
> displayable in the
> > Browser so that the designer and the programmer must work tightly.
> 
> The designer has to learn 'id="row_name"' in one case, and 
> $row_name in
> the other.  I'd say that the need to work tightly with the 
> programmer is
> pretty much the same: you have to agree on a syntax for gaps that code
> can fill, and on the names of the individual gaps.

There is one big difference in the enhydra approach: The templates are
standard HTML, because the id tag is part of the HTML standard. The designer
can create the whole site and make a dry test, because all links even work.
The tags (with ids) can contain valid values.

...darko



RE: Templating system

2000-07-27 Thread Darko Krizic

> > > Apache::ASP-> nice (session management), but still mixing

> I saw your note about Apache::ASP mixing... 
> with Apache::ASP a lead site engineer can define custom tags
> with XMLSubsMatch that will make XML tags execute
> as perl subs, check out: http://www.nodeworks.com/asp/xml.html

> Apache::ASP thus allows you to create your own set of 
> tags to lose the code mixing which is the bane of many
> a web designer.

Sorry for my note. The last version of Apache::ASP I used was about 1.0 I
think. I don't know the new features of Apache::ASP.

I like Apache::ASP, it is implemented well and is the best tool for writing
some code that requires lots of interaction (forms and so), mainly because
of the transparent Session Management. I used to write ASP under IIS with VB
so I like to concept of Apache::ASP (especially because there is Perl
inside).

...darko



RE: Templating system

2000-07-27 Thread Darko Krizic

> > How long do you think would this last? I could wait for 
> about 3 hours or so
> > ;-)
> 
> Well... longer than that. But even if I wrote something this 
> afternoon -
> you still wouldn't learn it very quickly.

No stress here please. If you do something then send it to me and I will
take a closer look at it.

> > The problem with many templating systems is the fact that 
> they invent a new
> > language like "$variable" which is usually not 
> displayable in the
> > Browser so that the designer and the programmer must work tightly.
> 
> Thats a problem with _all_ template systems, including XMLC. 
> With XMLC's
> method you still have problems with bits that get conditionally
> included. Sure, looping rows of tables look good, but wait 
> until you start
> using XMLC a lot. Then you'll find the flaws.

As I said: One problem with enhydra is that the id "x" is a .

> Better to start with a standard that you can build on, like 
> XSLT, IMHO.

Sure.

> > What other templating systems do exists that are usefull?
> 
> Thats a huge question, here's a few:
> 
> EmbPerl-> mixing of HTML and logic
> Template Toolkit   -> will take a look at it right now
> Apache::ASP-> nice (session management), but still mixing
> HTML::Template -> own language
> XSLT
> XPathScript (part of AxKit, which can also do XSLT) -> will take a look at
AxKit
> Mason  -> AFAIK mixing

Comments start with ->

...darko



RE: Templating system

2000-07-27 Thread Darko Krizic

> > The program now can repeat the tr "singlerow" for each 
> table row and insert
> > it under the tr "resultheader". The values can be inserted 
> into the tds
> > "row_name" and "row_count". The main advantage is: The 
> designer can generate
> > HTML pages that can be viewed with a standard browser.
> > 
> > Does anybody know something similar for Perl?
> 
> Hmmm. Depends what you mean. I think in your context, the Template
> Toolkit has many more obvious tags that will litter themselves in the
> HTML. However, using includes and macros effectively you reduce the
> amount of cruft in the code.

What is the Template Toolkit?

...darko



RE: Templating system

2000-07-27 Thread Darko Krizic

> > Newly I did something with Enhydra (Java Servlets) and they 
> have a pretty
> > neat templating system: They use standard HTML and one uses the "id"
> > attribute in HTML tags to access them and manipulate 
> values/contents.
> > [...]
> > Does anybody know something similar for Perl?
> 
> No, but I was thinking of incorporating enhydra's XMLC technology into
> AxKit. I'm not sure its a better method of working than XSLT or
> XPathScript though, which allows you to be future looking (always
> XML). But it could be kinda neat to do. Should be almost trivial with
> HTML::Parser to generate perl out of that. Providing of 
> course they don't
> have some stupid patent on it (doubtful since its GPL'd).
> 
> Can you wait, or do you need something now?

As you know projects must be finished until yesterday. It would be a dream
if we could share the templates between Enhydra and Perl. The only problem I
see here is the performance. Enhydra compiles the java and the HTML pages
and creates methods and a DOM model. Doing this on the fly (for mod_perl)
would be a big drawback in performance. Maybe there should be some kind of
precompiling.

How long do you think would this last? I could wait for about 3 hours or so
;-)

The problem with many templating systems is the fact that they invent a new
language like "$variable" which is usually not displayable in the
Browser so that the designer and the programmer must work tightly.

What other templating systems do exists that are usefull?

...darko



Templating system

2000-07-27 Thread Darko Krizic

I want to write a new application using mod_perl but this time I want to
completely divide the code from the HTML. Therefore I am seeking for a
powerfull and fast templating system.

Newly I did something with Enhydra (Java Servlets) and they have a pretty
neat templating system: They use standard HTML and one uses the "id"
attribute in HTML tags to access them and manipulate values/contents. For
example:



Name
Count

example name
example count



The program now can repeat the tr "singlerow" for each table row and insert
it under the tr "resultheader". The values can be inserted into the tds
"row_name" and "row_count". The main advantage is: The designer can generate
HTML pages that can be viewed with a standard browser.

Does anybody know something similar for Perl?

...darko





How to get User abc

2000-07-11 Thread Darko Krizic

I have a PerlTransHandler and I have a bunch of virtual hosts. Each virtual
host looks like this


User abc
Group abcs


(How) can I access the User and Group definitions in the VirtualHost (which
are intended for suexec)? Is this feature missing in mod_perl 1.24? The
eagle book only knows on mod_perl 1.19.

...darko
 



Perlhandler -> AUTH: Solved

1999-10-21 Thread Darko Krizic

This message was sent from Geocrawler.com by "Darko Krizic" <[EMAIL PROTECTED]>
Be sure to reply to that address.

Hello!

I just hacked a little PerlHandler (content handler) module that uses Basic auth. I 
found out that things like 

$r->note_basic_auth_failure;
my($res, $sent_pw) = $r->get_basic_auth_pw;
return AUTH_REQUIRED

do not work correctly for a content handler. Therefore I wrote this code:


#!/usr/bin/perl -w

package My;

use strict;
use Apache ();
use Apache::Log;
use Apache::Constants (qw/:common/);
use MIME::Base64;   # needed for decode of basic auth

sub handler
{
my $r = shift;
my $user;
my $password;
my $userpass = $r->header_in("Authorization") || undef;
Apache->request($r);
my $log = $r->log();

# optionally decode authorization
if( $userpass ) {   # got any authorization
if( $userpass =~ m/^Basic / ) {
# only basic
$userpass =~ s/^Basic //;   # remove leading
($user,$password)   # decode user + pass
= split(":", decode_base64 $userpass);
$log->warn("user=$user, password=$password");
}
}

unless( defined $user
and $user eq "DeKay" and 
defined $password
and $password eq "got it" 
) {
# no auth or auth not valid
$r->header_out("WWW-Authenticate" => "Basic realm=\"Test\"");
$r->content_type("text/html");
$r->status(AUTH_REQUIRED);
$r->send_http_header;
$r->print("Auth required");
return OK;
}

# auth valid
$r->content_type("text/html");
$r->send_http_header;
$r->print("user: $user");
$r->print("Password: $password");
return OK;
}

1;

Questions:

- This does not look very mod_perlish, can this be done "better"?
- How can I make Apache print its "Authentication required" message itself? In this 
module I have to do this by myself.

...darko


 
 


Geocrawler.com - The Knowledge Archive



PerlHandler -> AUTH_REQUIRED?

1999-10-18 Thread Darko Krizic

This message was sent from Geocrawler.com by "Darko Krizic" <[EMAIL PROTECTED]>
Be sure to reply to that address.

I have a PerlHandler (content handler) like this:


SetHandler  perl-script
PerlHandler BSB::MyScript
PerlInitHandler Apache::StatINC
PerlSendHeader  Off


Now I want to return a AUTH_REQUIRED if the URI begins with "/admin/" and the user has 
not authenticated. I this basically possible or is it "too late", since the auth and 
authz stages passed already?

...darko


Geocrawler.com - The Knowledge Archive