Re: Can't build Apache::Dispatch on Windows / Perl 5.8.0

2003-09-12 Thread Thomas Klausner
Hi!

On Thu, Sep 11, 2003 at 10:24:20PM -0500, Randy Kobes wrote:

 Here's a patch against the Apache-Dispatch Makefile.PL to
 allow it to build on Win32 - I've also put up a ppm package

Oh, great! Thanks Randy! I'll put this into the next release, which should
happen in a few days...

-- 
#!/usr/bin/perl   http://domm.zsi.at
for(ref bless{},just'another'perl'hacker){s-:+-$-gprint$_.$/}


Re: Can't build Apache::Dispatch on Windows / Perl 5.8.0

2003-09-11 Thread Thomas Klausner
Hi!

On Thu, Sep 11, 2003 at 08:33:31AM +0100, Steve Hay wrote:

 I posted this problem the other day, deep inside a thread about 
 something else, and didn't get any replies; maybe nobody spotted it?
 
 Does anybody have Apache::Dispatch working on Windows with Perl 5.8.0?   
 Randy?

Randy posted this some time ago:

 I just made one up, which you can install as
 C:\ ppm install
 http://theoryx5.uwinnipeg.ca/ppmpackages/Apache-Dispatch.ppd

Maybe this works for you?

See:
http://www.gossamer-threads.com/archive/mod_perl_C1/modperl_F7/Looking_for_Apache::Dispatch_PPD_P73122/


-- 
#!/usr/bin/perl   http://domm.zsi.at
for(ref bless{},just'another'perl'hacker){s-:+-$-gprint$_.$/}


Re: Can't build Apache::Dispatch on Windows / Perl 5.8.0

2003-09-11 Thread Thomas Klausner
Hi!

On Thu, Sep 11, 2003 at 08:59:23AM +0100, Steve Hay wrote:

 I would rather be able to build the module myself anyway, rather than 
 using a PPM package.

I guess (and Geoffrey (who BTW transfered maintainership of Apache::Dispatch
to me..) suggested something) the problem lies within the custom configuration
directives used by Apache::Dispatch.

I'm planning to make these optional in the next release of Apache::Dispatch,
so you could either use
  DispatchPrefix Bar
(which needs compiling)
or 
  PerlSetVar DispatchPrefix Bar
(which doesn't need compiling and should thus make installation easier)

 BTW, do other people have it working under Perl 5.8.0 on other 
 platforms?  I'm not sure if this problem is Windows-related or 
 5.8.0-related.

There is one FAIL reported on:
http://testers.cpan.org/show/Apache-Dispatch.html

I complied it without problem on Linux Perl 5.8.0 and 5.6.1.



-- 
#!/usr/bin/perl   http://domm.zsi.at
for(ref bless{},just'another'perl'hacker){s-:+-$-gprint$_.$/}


Re: Help wanted with locations / configuration

2003-09-09 Thread Thomas Klausner
Hi!

On Tue, Sep 09, 2003 at 10:05:43AM +0100, Steve Hay wrote:

 Location /myproject/css
   SetHandler default
 /Location
 Location /myproject/img
   SetHandler default
 /Location
 
 This is working as expected, i.e. request for /css/foo.css or /img/bar.png
 are not handled by Apache::Dispatch
  
 
 What about requests for /css or /img ?  Are they handled by 
 Apache::Dispatch?  The problem I found with my LocationMatch override is 
 that requests for files were caught, but requests for directories 
 slipped through to the Perl handler.

Unfourtunatly, request for /css are handled by Apache::Dispatch. At least it
seems so, but I'm enterly sure if it's the actual request that's beeing
served, or an internal redirect (or some other funky Apache internal thing,
like ErrorDocument or index generation)

It does seem like a feature/problem of Apache. I tried various config
options (and modifications to Apache::Dispatch), but no matter what I did,
request for /img/ allways get passed to PerHandler instead of default
handler

Request for anything inside /img/ work as expected.

No, wait a minute...

If I request /foo/bar/ (another dir) than it doesn't work either.

I still do not know if this a bug in
Apache / mod_perl / Apache::Dispatch / YourHandler, and/or internal redirect.
Or if this is expected behaviour.

-- 
#!/usr/bin/perl   http://domm.zsi.at
for(ref bless{},just'another'perl'hacker){s-:+-$-gprint$_.$/}


Re: Help wanted with locations / configuration

2003-09-08 Thread Thomas Klausner
Hi!

On Mon, Sep 08, 2003 at 04:51:55PM +0100, Steve Hay wrote:

 The project is going to be written as a series of mod_perl handlers - 
 one for the main home page, and others for various sub-components.  
 Each handler is implemented by a separate module (all sub-classes of a 
 common base class).  I don't want to have to configure a separate 
 Location for each sub-component.

You might want to take a look at Apache::Dispatch, which does exactly this.

 Location /myproject
SetHandler perl-script
PerlHandler MyProject-dispatcher
 /Location
 
 LocationMatch ^/myproject/(images|javascript|stylesheets)
SetHandler default-handler
 /LocationMatch

I'm using something like this with Apache::Dispatch

PerlModule Apache::Dispatch
DispatchUpperCase On   # this is /not/ in Apache::Dispatch, 
   # only in my patched version
DispatchPrefix Oe1
DispatchExtras Error

Location /myproject
   SetHandler perl-script
   PerlHandler Apache::Dispatch
/Location
   
Location /myproject/css
   SetHandler default
/Location
Location /myproject/img
   SetHandler default
/Location

This is working as expected, i.e. request for /css/foo.css or /img/bar.png
are not handled by Apache::Dispatch



-- 
#!/usr/bin/perl   http://domm.zsi.at
for(ref bless{},just'another'perl'hacker){s-:+-$-gprint$_.$/}


Re: Ticket/cookie based authentication for mod_perl and static frontend

2003-08-26 Thread Thomas Klausner
Hi!

On Die, Aug 26, 2003 at 09:06:05 +1000, Charlie Garrison wrote:

 I need to protect resources in both the static (proxy) front-end and the
 mod_perl back-end. I have been using standard http authentication which works
 pretty well except for not allowing a proper logout function and some caching
 issues which result in occasional false FORBIDDEN responses. Since a proper
 logout has become an important requirement, I am looking for other solutions.

Did you take a look at Apache::AuthCookie?
  http://search.cpan.org/author/MSCHOUT/Apache-AuthCookie-3.04/

 Since I need the user credentials in the mod_perl app, I'm not happy to leave
 all authentication to the front-end proxy server unless it sets the user
 credentials (or some other values) before passing along the request.

As AuthCookie is a mod_perl handler, you would have to put the
Authentification into the backend. Depending on how you generate the session
key (i.e. the value of the Auth Cookie), you should be able to use the
cookie in the frontend using one of the modules you mentioned (although I
don't know any of them..)


-- 
#!/usr/bin/perl   http://domm.zsi.at
for(ref bless{},just'another'perl'hacker){s-:+-$-gprint$_.$/}


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Re: Coding Style Question - Using exit

2003-08-19 Thread Thomas Klausner
Hi!

On Mon, Aug 18, 2003 at 08:07:30 -0400, Chris Faust wrote:

 Example To Help Explain:
 
 sub handler {
  $r = shift;
 
 init_global_vals();
 
 $back_url = determine_proper_action();
 
 my $back_url = ;
 $r-headers_out-set(Location = $back_url);

 return Apache::REDIRECT;
 }

Why not let determine_proper_action() return undef (or OK, or whatever) if
you do not want to redirect? And in your handler do:

  my $rv=determine_proper_action();
  if ($rv) {  # or ($rv == Apache::Constants::OK)
 # redirect
  } else 
# done
  }

One problem I can see is if you're exiting somewhere deep in a nested sub
and you cannot propagate the return value back to the handler (easily).


-- 
#!/usr/bin/perl   http://domm.zsi.at
for(ref bless{},just'another'perl'hacker){s-:+-$-gprint$_.$/}


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Re: Mod_perl how to include the result of mod_autoindex?

2003-08-14 Thread Thomas Klausner
Hi!

On Mon, Aug 11, 2003 at 04:37:45 -0500, Slava Bizyayev wrote:
 It's not quite the truth...
 You can do all that staff on Apache 1.3 with appropriate skills. See LWP
 for example.

If you mean to grab the output of e.g. mod_autoindex by issueing a sperate
request using LWP, that's definitly possible. But I would classify this as a
hack and not as a proper way to implement a feature.

Or /is/ there a clean way to properly filter output from different response
handlers with Apache 1.3? I'd realy like to hear about it...

-- 
#!/usr/bin/perl   http://domm.zsi.at
for(ref bless{},just'another'perl'hacker){s-:+-$-gprint$_.$/}


Re: Mod_perl how to include the result of mod_autoindex?

2003-08-11 Thread Thomas Klausner
Hi!

On Mon, Aug 11, 2003 at 08:37:19AM -0700, Coexec wrote:
 I am writing a mod_perl script using CGI.pm and Apache
 1.3.28/Linux.
 
 I am trying to figure out how to use Apache's
 mod_autoindex to display a directories contents within
 the output the CGI.  Apache is configured correctly, I
 am not asking for Apache help.

This is not possible using Apache 1.3. What you want to do is called
filtering and is available with Apache/mod_perl 2.0.

http://perl.apache.org/docs/2.0/user/intro/overview.html#Integration_with_2_0_Filtering

With Apache 1.3, you cannot (e.g.) generate content with mod_perl that
includes Server-Side-Include directives.  You also cannot get the content of
mod_autoindex and further process this content using something.

What does work is to use only mod_perl, as suggested by Christopher Grau

-- 
#!/usr/bin/perl   http://domm.zsi.at
for(ref bless{},just'another'perl'hacker){s-:+-$-gprint$_.$/}


Re: [QUESTION] Can't read out verified username (auth)

2003-07-21 Thread Thomas Klausner
Hi!

On Mon, Jul 21, 2003 at 12:36:55 +0200, Fatih Gey wrote:
 I supposed the browser to resend always an unique bowser session id, which
 is used by apache to save certain values, like $ENV{'REMOTE_USER'}
 (similiar to a session-cookie with uid and serverbased $vars) .. 
 Isn't this the way Basic Authentication scheme works ? .. 

I do not know how much Auth stuff changed in Apache 2.0/mod_perl 2, but you
seem to mix up checking user credentials in the response phase (as done in
CGI or PHP) with writing you own Auth Handlers that replace the standard
Apache ones.

If you get the user credentials via a web form, you are usually NOT using
BASIC Auth but your own scheme (or something like Apache::AuthCookie). Thus,
$r-connection-user is not set.

Take a look at:
* Chapter 6 of the Eagel book, available online at:
  http://modperl.com:9000/book/chapters/ch6.html
  
* Chapter 13.7 of the mod_perl Cookbook

* Apache::AuthCookie

At least that's how it works with mod_perl 1.x ...

-- 
#!/usr/bin/perl   http://domm.zsi.at
for(ref bless{},just'another'perl'hacker){s-:+-$-gprint$_.$/}


Re: How do I have a PerlAuthenHandler not popup the login box?

2003-07-18 Thread Thomas Klausner
Hi!

On Thu, Jul 17, 2003 at 06:07:48PM -0700, Jason Fong wrote:
 I'm making a login system that uses a web form instead of the browser's
 popup box to input the username/password.  My problem is that when I use
 my authentication script as a PerlAuthenHandler in the .htaccess, it
 insists on having the browser show the popup username/password box.  I
 tried making a simple handler function that just returns OK, but I still
 get the login box.

This the way BASIC Authentication works. To solve your problem (cleanly),
you'll need to use your own custom authentication mechanism. This is not
as hard as it sound.

Take a look at Apache::AuthCookie for an example (quite likely it is exactly
what you are looking for)

Or read chapter 13.7 Writing your own authentication mechanism in the
mod_perl Cookbook.


 
-- 
#!/usr/bin/perl   http://domm.zsi.at
for(ref bless{},just'another'perl'hacker){s-:+-$-gprint$_.$/}


Re: How to share subroutine

2003-07-17 Thread Thomas Klausner
:Hi!

On Wed, Jul 16, 2003 at 10:46:27PM +0100, Ged Haywood wrote:
 Hi there,
 
 On Wed, 16 Jul 2003, Matthew Wu wrote:
 
 I put all my subroutine in file.pm, what I need to do such that it
  can be used by my program? I don't what location I need to put it in and
  what kind of configuration I need to modify. I am running Redhat 6.3.
 
 At the risk of repetition... :)

Ha! :-)

 This is a mailing List specifically for mod_perl issues.
 Are you using mod_perl?

If you're using mod_perl, you might find this helpful:
http://perl.apache.org/docs/general/perl_reference/perl_reference.html#userequiredo_INC_and__INC_Explained
and
http://perl.apache.org/docs/1.0/guide/config.html#The_Startup_File

especially:
  use lib qw(/path/to/module);

But, as Ged allready mentioned, please RTFM! The mod_perl docs are really
great, so please DO read them.

http://perl.apache.org


-- 
#!/usr/bin/perl   http://domm.zsi.at
for(ref bless{},just'another'perl'hacker){s-:+-$-gprint$_.$/}


Re: mod-perl - read

2003-07-15 Thread Thomas Klausner
Hi!

On Mon, Jul 14, 2003 at 04:46:37PM -0500, Siva Yendapalli wrote:
 I am totally a newbie to mod_perl. I could able to get the content length
 using $r-headers_in(Content-Length). but I don't see anything in the $buf
 when I call the function $r-read($buf,$r-headers_in(Content-Length)). I

Is there any reason you want to parse the request yourself? You can use
Apache::Request to access the POST/GET data

 am sure I am doing some thing wrong with the configuration or with mod_perl 
 program. Please can some body give me an example and what I should do with
 the configuration to load the program. 

see perldoc Apache::Request

The mod_perl Website http://perl.apache.org also has a huge amount of
information (including pointers to the various mod_perl books).

-- 
#!/usr/bin/perl   http://domm.zsi.at
for(ref bless{},just'another'perl'hacker){s-:+-$-gprint$_.$/}


Re: Apache dont run

2003-07-14 Thread Thomas Klausner
Hi!

On Mon, Jul 14, 2003 at 04:59:17PM +0100, AROSO Jose Antonio wrote:

 I install the all in one package which contain the modperl 2.0 and de apache
 server 2.0.46.
 But after install when i write in command line apache to run the server
 appears The dynamic link library libxml2.dll could not be found.
 What do i do?

Read this:
http://perl.apache.org/maillist/email-etiquette.html


-- 
#!/usr/bin/perl   http://domm.zsi.at
for(ref bless{},just'another'perl'hacker){s-:+-$-gprint$_.$/}


Re: Problem with PerlTransHandler

2003-06-27 Thread Thomas Klausner
Hi!

On Fri, Jun 27, 2003 at 02:47:45PM +0400, Sergey V. Stashinskas  wrote:

 sub handler {
 my $r = shift;
 
 my $dbh = DBI-connect('dbi:mysql:db', 'user', 'pswd');
 $dbh-disconnect;

maybe the DBI-connect isn't working and thus your script dies / throws some
error ? 

I'd try to check if connect works, if $dbh works, etc.

-- 
#!/usr/bin/perl   http://domm.zsi.at
for(ref bless{},just'another'perl'hacker){s-:+-$-gprint$_.$/}


Re: Current directory

2003-06-17 Thread Thomas Klausner
Hi!

On Tue, Jun 17, 2003 at 02:19:49AM +0200, Oskar wrote:

 when I am executing perl script on Apache it seems that the current
 directory is not the directory where the script is located but the directory
 c:\program files\apache group\apache. I need current dir to be the script
 dir since i have some pm in the script directories.
 I have apache 1.3.27 and mod_perl 1.

See:
http://perl.apache.org/docs/1.0/guide/porting.html#_INC_and_mod_perl


-- 
#!/usr/bin/perl   http://domm.zsi.at
for(ref bless{},just'another'perl'hacker){s-:+-$-gprint$_.$/}


Re: How tell what version of mod_perl is installed?

2003-06-06 Thread Thomas Klausner
Hi!

On Thu, Jun 05, 2003 at 01:37:59PM -0700, Dennis G. Allard wrote:
 Please note, though, one of my goals in life is to rely on my software
 providers to do the work of providing me with a stable, tested,
 updatable OS and associated tools.  If I download 'out of band' updates,
 then I can no longer rely on Red Hat's network update tool, for example.
 
 With all due respect for your fine work, which is awesome, there are
 application developers such as myself out there who simply don't have
 time to track the bleeding edge except when absolutely forced to do so
 (which sometimes does happen).

The latest Red Hat comes with Apache 2 (because Apache 2 is quite stable).
Unfortunatly mod_perl 2.0 is /not/ that finished (Sorry Stas..). But because
Red Hat wants to provide mod_perl to its Users, they included the Beta
Version in their distro.

So blame them ...

  /home/stas perl-blead   -Mmod_perl -le 'print mod_perl-VERSION'
  1.2701
  /home/stas perl-blead -MApache2 -Mmod_perl -le 'print mod_perl-VERSION'
  1.9910
 
 Bummer, I don't have perl-blead and there are only 17 references to it
 in the entire history of Dejanews, none that seem to point to a
 download...

You don't need perl-blead (which is probably Stas' install of the latest
unstable Perl version)

This will do the same job:
% perl -Mmod-perl -le 'print mod_perl-VERSION'


-- 
#!/usr/bin/perl   http://domm.zsi.at
for(ref bless{},just'another'perl'hacker){s-:+-$-gprint$_.$/}


Re: How tell what version of mod_perl is installed?

2003-06-06 Thread Thomas Klausner
Hi!

On Thu, Jun 05, 2003 at 01:56:58PM -0700, Dennis G. Allard wrote:
  You don't need perl-blead (which is probably Stas' install of the latest
  unstable Perl version)
  
  This will do the same job:
  % perl -Mmod-perl -le 'print mod_perl-VERSION'
 
 Bummmer, that does not work either for me on Red Hat 8.0:

Sorry, typo: it should say -Mmod_perl instead of -Mmod-perl, i.e.:

% perl -Mmod_perl -le 'print mod_perl-VERSION'

-- 
#!/usr/bin/perl   http://domm.zsi.at
for(ref bless{},just'another'perl'hacker){s-:+-$-gprint$_.$/}


[OT] Re: pl extension

2003-06-06 Thread Thomas Klausner
Hi!

On Thu, Jun 05, 2003 at 11:00:37AM +0200, [EMAIL PROTECTED] wrote:

 I'm running redhat 9 and trying to execute a perl script through a web
 browser 
 
 http://host/file.pl 
 
 and the file displays as text, how do i get my apache to recognize this
 extension? 

This doesn't seems like a mod_perl question to me. Try a general CGI list:
http://lists.perl.org/showlist.cgi?name=cgi-list

Or read the Apache Docs, especially the section on ScriptAlias:
http://httpd.apache.org/docs-2.0/mod/mod_alias.html#scriptalias


-- 
#!/usr/bin/perl   http://domm.zsi.at
for(ref bless{},just'another'perl'hacker){s-:+-$-gprint$_.$/}


Re: mod_perl caching form data?

2003-05-30 Thread Thomas Klausner
Hi!

On Thu, May 29, 2003 at 12:19:49PM -0500, David Ressman wrote:

 So far, so good.  Everything works pretty well...  Except that
 something's caching previously entered form data and displaying it back
 to me as the default values in those same forms.  As an example, this
 form has a text field that asks for IP addresses, and the text input
 will occasionally be filled out with the IP address of a system that
 you had entered a few minutes ago.

Sounds to me like you are storing your values in global variables which
won't get reset between requests.

Do you declare you vars with 'my' ?

Are you running with
 use strict;
 use warnings;
? If not, turn them on, as thos pragmas will help you catch this kind of
error.

See here:
http://perl.apache.org/docs/1.0/guide/porting.html#Global_Variables_Persistence


-- 
#!/usr/bin/perl   http://domm.zsi.at
for(ref bless{},just'another'perl'hacker){s-:+-$-gprint$_.$/}


Re: how to secure perl modules?

2003-05-30 Thread Thomas Klausner
Hi!

On Thu, May 29, 2003 at 10:27:54AM -0700, iCap wrote:
 i have a collection of perl modules (running under the mod_perl umbrella)
 and would like to distribute the application to several different sources
 (clients with open internet web servers).  but i dont want to send it out
 without at least making it somewhat difficult for some hacker to just simply
 steal it and load it somewhere else without my consent.  what options do i
 have (if any) to secure the code so that it can't be 'easily' stolen?
 'easily' being the operative word here, as i realize it wont be 100% safe no
 matter what i do.
 the ideal would be to perhaps encrypt some of the code, maybe a few of the
 base configuration modules, maybe even the startup.pl file, others?

If you want to make it hard to read the code, use an Obfuscator (eg.
Acme::EyeDrops)

If want to really secure your code: it's not possible, see this thread on
perlmonks:
http://www.perlmonks.org/index.pl?node_id=243011
or search in the mailinglist archives. This questions was discussed here a
few times.

-- 
#!/usr/bin/perl   http://domm.zsi.at
for(ref bless{},just'another'perl'hacker){s-:+-$-gprint$_.$/}


Re: cgi.pm does not work in handlers (why responsehandlers at all ?)

2003-04-01 Thread Thomas Klausner
Hi!

On Wed, Apr 02, 2003 at 12:49:56AM +0200, [EMAIL PROTECTED] wrote:

   Is the O'Reilly about apache-modules what I'm looking for ? I've the
 small O'reilly about mod_perl but it raises more questions than its
 answers.

The Eagle book is definitly very interesting (if a little bit old - BTW, is
there a new edition scheduled for mod_perl 2?).

You can find lots of other usefull docs at 
  http://perl.apache.org
including pointers to other books (eg. the mod_perl Developers Cookbook)


-- 
#!/usr/bin/perl   http://domm.zsi.at
for(ref bless{},just'another'perl'hacker){s-:+-$-gprint$_.$/}


Re: inline mod_perl - is this possible?

2003-03-19 Thread Thomas Klausner
Hi!

On Wed, Mar 19, 2003 at 03:55:20AM -0800, www.ReadNotify.com wrote:

 I want to do this (serverside of course); is it
 possible?
 
 html
 I am running 
 !#perl
 print $ENV{MOD_PERL};
 print process ID $$;
 /!#perl
 on Apache!!
 /html
 
 What modules/config/etc do I need to set up?

There are various templating system / app servers on CPAN that let you do
this. Take a look at (e.g.) Mason or Embperl.

There is also Perrin Harkins article on Choosing a Templating System that
describes those (and other) systems;
http://perl.apache.org/docs/tutorials/tmpl/comparison/comparison.html


http://www.masonhq.com/
What Is Mason?
Mason is a powerful Perl-based web site development and delivery engine.
With Mason you can embed Perl code in your HTML and construct pages from
shared, reusable components.


http://perl.apache.org/embperl/
Embperl is a framework for building websites with Perl. For the beginner
it's an easy to setup and use way of embedding Perl code in HTML pages. It
delivers several features that ease the task of creating a websites,
including dynamic tables, formfield-processing, escaping/unescaping, session
handling, caching and more.



-- 
#!/usr/bin/perl   http://domm.zsi.at
for(ref bless{},just'another'perl'hacker){s-:+-$-gprint$_.$/}


Re: Using a Startup.pl

2003-03-18 Thread Thomas Klausner
Hi!

On Tue, Mar 18, 2003 at 01:39:41PM -0500, Chris Faust wrote:

 I'm running mod_perl 2 on RedHat with Apache 2.0.44 and I'm using NamedBased
 Virtual Hosting in apache (so I have a number of virtual hosts and apache
 directs properly based on hostname).
 
 I use a startup.pl to load up common things like DBI, CGI, HTML::Template
 etc..
 
 Should I have just a single startup.pl and will that work with all virtual
 hosts? Or should I have a startup.pl per virtual host.

AFAIK, and with mod_perl 1.x, having multiple startup.pl's makes no sense as
they all get executed during server startup and in the main namespace. 


-- 
#!/usr/bin/perl   http://domm.zsi.at
for(ref bless{},just'another'perl'hacker){s-:+-$-gprint$_.$/}


Re: [mp2] disabling a perl handler within a specific location

2003-03-04 Thread Thomas Klausner
Hi!

On Tue, Mar 04, 2003 at 12:54:30AM -0500, Matt Avitable wrote:

 Does anyone know how one goes about disabling a particular handler 
 within a specific location?  For example, consider the following:
 
Location /
 PerlInitHandler config
 PerlOutputFilterHandler filter
 /Location
 
LocationMatch /(images|gfx)/
   ## what can I put here to say don't run to the above handlers?
/Location

This works for Auth*Handlers, so it should work for any phase:

LocationMatch /(images|gfx)/
   PerlInitHandler Apache::Constants::OK
/Location

See recipy 7.3 in the Cookbook


-- 
#!/usr/bin/perl   http://domm.zsi.at
for(ref bless{},just'another'perl'hacker){s-:+-$-gprint$_.$/}


Re: Server side programming PHP Vs CGI Vs modPerl

2003-02-14 Thread Thomas Klausner
Hi!

On Fri, Feb 14, 2003 at 03:52:35PM +0530, Devi .M wrote:

   Now I tried authenticating the user, where I have to maintain
 separate session for each user. When I saw how to do session management in
 mod_perl a module called Apache::Session was told. But when I tried it,
 that module was missing in my mod_perl. So I want to know, whether I have
 to download this module separately, or what version of mod_perl will it be
 available?

You'll have to download Apache::Session (and probably a lot of other usefull
modules) seperatly from CPAN, http://www.cpan.org (though I prefer
http://search.cpan.org)

Or, use the CPAN-shell that comes with Perl

(as root)
% cpan
or
% perl -MCPAN -eshell

cpan install Apache::Session



-- 
#!/usr/bin/perl   http://domm.zsi.at
for(ref bless{},just'another'perl'hacker){s-:+-$-gprint$_.$/}



Re: Server side programming PHP Vs CGI Vs modPerl

2003-02-14 Thread Thomas Klausner
Hi!

On Sat, Feb 15, 2003 at 12:07:28PM +0530, Devi .M wrote:

 After authentication I have to redirect to 
 another page,if the user and passwd is right. I am able to view my HTML
 page also correctly but below the page the following message is displayed.
 When I checked the error.log , there was no error thrown in it. Can anyone 
 help me how to overcome this
 
 ---
 HTTP/1.1 200 OK Date: Sat, 15 Feb 2003 06:46:02 GMT Server: Apache/1.3.27 
 (Unix)
 mod_perl/1.27 Connection: close Content-Type: text/html Embedded Perl 
 version v5.6.1 for
 Apache/1.3.27 (Unix) mod_perl/1.27 process 1614, 
 running since Sat Feb 15 11:49:25 2003

 Perl Configuration
 Loaded Modules
 Inheritance Tree
 Enabled mod_perl Hooks
 Environment
 PerlRequire'd Files
 Signal Handlers
 Symbol Table Dump
 ISA Tree
 Compiled Registry Scripts
 
 ---

This looks like the output of Apache::Status.

Without further information about your configuration etc, help is hardly
possible.

Please read the mod_perl documentation at
  http://perl.apache.org
and take an even closer look at
  http://perl.apache.org/docs/1.0/guide/help.html#How_to_Report_Problems




-- 
#!/usr/bin/perl   http://domm.zsi.at
for(ref bless{},just'another'perl'hacker){s-:+-$-gprint$_.$/}



Re: Obfusacating the source

2002-11-19 Thread Thomas Klausner
Hi!

On Tue, Nov 19, 2002 at 07:08:00PM +, Mark Fowler wrote:
 
  I need some tool that gets all the perl modules and
  mason components, of an application we made, and obfucaste
  it a little.
 
 See Acme::Bleach

In fact you're probably better off using Acme::EyeDrops

http://search.cpan.org/author/ASAVIGE/Acme-EyeDrops-1.16/lib/Acme/EyeDrops.pm

With Acme::Bleach, you'll need to say

  use Acme::Bleach

at the beginning of your bleached module.

Acme::EyeDrops uses a big Regex, or (probably saver for your needs)
call it with Regex = 0 to generate a string to be evaled. So no need
for 'use Acme::EyeDrops', so no telltale sign for the cracker.

But no matter what Obfuscator you use: Obfuscation won't stop a determined
reader to get to the source. 

shameless plug
You might want to check out the slides of my talk The Dark Art of
Obfuscation, held at YAPC::Europe 2002:
  http://domm.zsi.at:/talks/obfu_yapc2002/
/shameless plug

-- 
#!/usr/bin/perlhttp://domm.zsi.at
for(ref(bless[],just'another'perl'hacker)){s-:+-$-gprint$_.$/}



Re: RFC: Template::YetAnother

2002-11-16 Thread Thomas Klausner
Hi!

On Sat, Nov 16, 2002 at 10:43:44AM +0100, Marcin Kasperski wrote:

 One note: while talking about templating systems for generating HTML,
 it can be inspiring to take a look at the Zope Page Templates (yes, I
 know, this is the python/zope world, not perl...). They found the nice
 idea of injecting loops/ifs etc into HTML in the way which does not
 spoil HTML markup. 

There is a simmilar Perl implementation of this called HTML_Tree
http://homepage.mac.com/pauljlucas/software/html_tree/

A module based on HTML_Tree is on CPAN under the name of
HTML-Seamstress:
http://search.cpan.org/author/TBONE/HTML-Seamstress-1.17/Seamstress.pm



-- 
#!/usr/bin/perlhttp://domm.zsi.at
for(ref(bless[],just'another'perl'hacker)){s-:+-$-gprint$_.$/}



Re: RFC: Template::YetAnother

2002-11-16 Thread Thomas Klausner
Hi!

On Fri, Nov 15, 2002 at 07:05:49PM -0800, Josh Chamas wrote:

 Don't do it.  If you want a stripped down version of
 ..
 evolution of these things.  The perl template user community is
 already fractured enough,

I expected that canonical answer to all Template Proposals :-)

 better to hop onto a project, hack it to your
 satisfaction ( with the blessing of the maintainers ) to get
 the configs/subclasses you need for your requirements.

I will take a closer look if my ideas could be implemented by
subclassing/extending Template Toolkit or CGI::FastTemplate.

But do you think that the concept sounds reasonable in the first
place?

-- 
#!/usr/bin/perlhttp://domm.zsi.at
for(ref(bless[],just'another'perl'hacker)){s-:+-$-gprint$_.$/}



Re: RFC: Template::YetAnother

2002-11-16 Thread Thomas Klausner
Hi!

On Sat, Nov 16, 2002 at 03:31:39PM -0500, Perrin Harkins wrote:
 I also posted this on perlmonks:
 http://www.perlmonks.org/index.pl?node_id=213300
 
 Ovid on Perlmonks already said some of the things I would have said 
 about needing a presentation language.  For a templating system to be 
 useful, it has to be able to deal with loops and conditionals.  Your 
 system pushes those into the Perl code, splitting the presentation 
 control into multiple places.  This fails one of my major goals: the 
 template coders should be able to change the presentation without help 
 from a Perl coder.  What if they decide they don't want to loop through 
 the links, but rather just print a message saying there are some?  What 
 if they only want to show the first two?  What if they want to display a 
 list with commas between the elements where they didn't use a separator 
 before?  A mature templating system can handle all of these issues 
 without changing the main Perl module code.

That's a very good point I didn't really think about. I was thinking
of templates as DUMB frontends that should just display
data. Period. 

Thinking of them as tools that handle presentation logic (as Ovid
pointed out) seems to make more sense. 

It does pay of to write RFCs before starting to code...

 Because IMO, the main reason for using templates is to seperate code
 from markup.
 
 It sounds to me like you want one of the HTML attribute ones, like Petal 
 or HTML::Seamstress.  What was wrong with those?

One problem I see with HTML::Seamstress is that it uses the HTML
attributes 'class' and 'id' for templating info. But those attributes
are used by CSS and JavaScript and might conflict somehow. I do not
know if you can change the behaviour of HTML::Seamstress to use other
attributes, though. But this stopped my from looking further.

And I didn't look at Petal. For now.
 
 There is one module, CGI::FastTemplate, that does seperate code from
 markup completly. But the way different templates are strung together
 seems rather comlicated to me.
 
 It's not complicated, but it is somewhat confusing the first time you 
 look at it.  I don't find your approach much easier though.

Well, I found mine easier :-)
(But I guess this is the reason for the Template Flood on CPAN -
everbody finds his own solution easier...)

 Isn't your fill method just doing a sort of multi-level join here?  All 
 of the data is passed in already, so there is no reason to delay 
 evaluation of the templates.

The main reason for doing this was to simplify testing. I planned to
just test the plain data structures, that should be free of HTML at
this time (before the fill). This (testing) was in fact the reason I
started thinking about this proposal in the first place.

 More importantly, your use of AUTOLOAD to treat method calls as file 
 names looks neat, but is not a good approach.  It's limiting (all 
 templates in one directory!) and has potential security issues with 
 namespace clashes.  These are all just the same method call with a 
 single argument changed, so why not write them that way?

I planned to handle those namespace and filename issues.
 
 ..
 force you to use them.  They are flexible modules.  I think you should 
 look at them more closely before you go off on your own.

That's what I'll do. Thanks for the excellent feedback.

-- 
#!/usr/bin/perlhttp://domm.zsi.at
for(ref(bless[],just'another'perl'hacker)){s-:+-$-gprint$_.$/}



RFC: Template::YetAnother

2002-11-15 Thread Thomas Klausner
..). I'll really appreciate feedback on this.

I hope that this descripction is clear enought. If not, let me know and I'll post some 
clarification / examples.

=head1 SYNOPSIS

  # generate a new template handler
  my $th=Template::YetAnother-new
({
  namespace='acme',
  template_dir='/projects/acme/templates/',
 });
 
  # build up a data structure
  $data={
 title=$th-title('this is the title'),
 breadcrumb=[
  $th-link({url='/index.html',text='Home'}),
  $th-separator_breadcrumb,
  $th-link({url='/acme/index.html',text='Acme'}),
  $th-separator_breadcrumb,
  $th-link({url='/acme/bleach.html',text='Bleach'}),
 ],
 content=[
   $th-element({heading='SYNOPSIS',value='blabla'}),
   $th-element({heading='DESCRIPTION',value='foo bar'}),
  ],
 lastmod=scalar localtime,
 
};

   # fill template  print
   print $th-fill({data=$data});
 
   ##
   # for this to work, we need the following files in
   # /projects/acme/templates
 
   # file: main.tpl
   htmlheadtitle[% title %]/title/head
   body
   center[% breadcrumb %]/center
   h1[% title %]/h1
   [% content %]
   hr
   [% lastmod %]
 
   # file: link.tpl
   a href='[% url %]'[% text %]/a
 
   # file: seperator.tpl
/ 
 
   # file: element.tpl
   h3[% heading %]/h3
   p[% value %]/p
 
   ##
   # the finished template should look like this:
 
   htmlheadtitlethis is the title/title/head
   body
   center
   a href='/index.html'Home/a /
   a href='/acme/index.html'Acme/a /
   a href='/acme/bleach.html'Bleach/a
   /center
   h1this is the title/h1
   h3SYNOPSIS/h3
   pblabla/p
   h3DESCRIPTION/h3
   pfoo bar/p
   hr
   Thu Nov  7 21:51:05 200


=head1 DESCRIPTION

=head2 new

  my $th=Template::YetAnother-new({
template_dir='/path/to/templates/',
# namespace='projectname',
# start_tag='--',
# end_tag=  '--',
});

Generates a new Template::YetAnother Handler Object.

=head2 fill

  $th-fill($data);

Fill the template with the data in the data structure.

=head2 _gen

  my $fragment=$th-_gen('type',$data)

Generates a new Template Fragment

You usually do not have to call this. You just say

  $th-type($data)

and AUTOLOAD passes it to C_gen

=head1 EXPORT

Nothing.

=head1 SEE ALSO

Search for Ctemplate on http://search.cpan.org, if you dare.

=head1 AUTHOR

Thomas Klausner, [EMAIL PROTECTED], http://domm.zsi.at

=head1 COPYRIGHT

This module is Copyright (c) 2002 Thomas Klausner, ZSI.
All rights reserved.

You may use and distribute this module according to the same terms
that Perl is distributed under.

=cut


-- 
#!/usr/bin/perlhttp://domm.zsi.at
for(ref(bless[],just'another'perl'hacker)){s-:+-$-gprint$_.$/}



Re: Hiding perl code

2002-07-22 Thread Thomas Klausner

Hi!

On Sun, Jul 21, 2002 at 10:58:24PM -0400, Jonathon M. Robison wrote:
 Anyone know offhand a good way to hide your perl code when using 
 mod_perl? Acme::Bleach isn't doing it - httpd is failing to start on 

You could write an obfuscator. Maybe Acme::EyeDrop works?

See

http://domm.zsi.at/source_code/obfu/O.pm

for an obfuscated mod_perl handler.

A very simple thing to do is eg:

$yourcode=s/\s+/~/gs;

Than, in to be obfuscated module, do:

$_='package~Your::Code'.$yourcode;s/~/ /g;eval;

That's basically what I did in my mod_perl obfu.

This definitly isn't unbreakable, but (if you add some more
obfu-tricks and maybe do some encryption on the code to be evaled)
would require some knowledge to deparse.

I guess you started this thread on perlmonks? 
http://www.perlmonks.org/index.pl?node_id=183932
If not, read it.


-- 
#!/usr/bin/perlhttp://domm.zsi.at
for(ref(bless[],just'another'perl'hacker)){s-:+-$-gprint$_.$/}



Re: Static vs. DSO on Linux specifically

2002-07-22 Thread Thomas Klausner

Hi!

On Mon, Jul 22, 2002 at 10:26:32AM -0500, David Dyer-Bennet wrote:

 So, specifically for the Linux environment, what are the downsides of
 running mod_perl as a DSO?  (Pointers to the FM so I can R it would be
 fine.) 

Did you take a look at this:

http://perl.apache.org/docs/1.0/guide/install.html#Pros_and_Cons_of_Building_mod_perl_as_DSO

?

-- 
#!/usr/bin/perlhttp://domm.zsi.at
for(ref(bless[],just'another'perl'hacker)){s-:+-$-gprint$_.$/}



[OT] mod_perl obfuscation / T-shirt ?

2002-06-11 Thread Thomas Klausner

Hi!

Concerning the yearly what to put on the t-shirts-discussion...

I was thinking about doing a mod_perl Obfuscation for some time, and today I
found some time and wrote up something .. It's not that much obfusacated,
but it looks nice (mod_perl in ASCII art) and works (see the POD after the
code..)

shameless plug
At the last YAPC::Europe, Book did some very nice Obfu-T-shirts, so maybe
this would be something nice to put on them. 
/shameless plug

In case your MUA fucks up the linebreaks, you can download it from here:
http://domm.zsi.at/source_code/obfu/O.pm

# start of file

$_  ='
pa  ck
ag  e~
O;  Sj
{-2$j++}  Sa{retur  n~0~if(Q-getxpw  )[1]eqm  od_perlR  ul
z;Q-note  xfailure  ;401}SM{open(O,Q  -fi  lename)|  |r
et  ur  n~  404;  $_=join  ,O;cl  oseO  ;m
y$  b=  Q-  dir  _config(  O)||
p  hp  |a  sp|java  ;s/~($b)  /~mod_pe  rl/ig;p~  Q;print;  0}Sp
{p  op  -  send_htt  p_header  }Sh{p~po  p;print  $$:$j;0  }1';
  $a
  ++
  ;;

s/\s//gs;s/S/sub~/g;s/~/ /g;s/Q/'$_[0]'/eg;s/x/_basic_auth_/g;eval;__END__   

=pod

=head1 NAME

O.pm - A collection of obfuscated mod_perl Handlers

=head1 SYNOPSIS

  PerlModule O

  Location /someplace/
 PerlLogHandler O::j
  
 PerlAuthenHandler O::a
 AuthName Locked
 AuthType Basic
 require valid-user
  
 Sethandler perl-script
 PerlHandler O::M
  
 # to change other strings then the default:
 # PerlSetVar O asp|python
  /Location
  
  Location /someplace/viewlog
 Sethandler perl-script
 PerlHandler O::h
  /Location

=head1 DESCRIPTION

It's not that clear to read, but the source code of O.pm spells
out Fmod_perl (underlined). Maybe looks nice on a T-shirt?

O.pm contains 4 different mod_perl handlers:

=head2 O::j

O::j is a PerlLogHandler using a per-child global value to count
the hits of each child. See LO::h on how to read that value.

=head2 O::a

O::a is a PerlAuthenHandler. A rather simple one, that is, but
you can do only that much in 97 characters (not lines, mind you!)
of code ...

You can enter any User-ID, but you will need to know the right
password. No need to document that here, as you can find it easily
in the source code. Wait a minute, Bwhy am I writing docs at
all ?

=head2 O::M

O::M is a PerlHandler (i.e. generating content. Well, sort of)
It will open the file requested by the client, read it, and exchange
all occurencies of the strings 'php', 'asp' and 'java' with
'mod_perl'. Now, that's advocacy! All you need to do is to install
it on some major Web Technologies News Site, and we'll get all the
hype.

In case some new Ihot technologie comes out, you can set the
string of values to be replaced with

  PerlSetVar O some|new|technologies

Please note that there is even some minor context checking taking
place: The string won't get replaces if it occures right behind a
I. (dot, that is), so that e.g. links to Iguestbook.php still
work.

=head2 0::h

O::h is another PerlHandler. Use it to find out how many hits the
current child has served. You'll even get the IPID of the child.

=head2 O::p

Just a utility function used to send the headers (and to avoid
redundant code).

=head1 INSTALLATION

Dump it somewhere Apache can find it.

=head1 De-Obfuscation

To tired now. But I will post the obfu on perlmonks.org, and a
de-obfuscation probably somewhen later.

=head1 Author

Thomas Klausner, [EMAIL PROTECTED]

=head1 COPYRIGHT

O.pm is Copyright (c) 2002 Thomas Klausner.
All rights reserved.

You may use and distribute this module according to the same terms
that Perl is distributed under. If you dare.

=cut



-- 
 D_OMM  +  http://domm.zsi.at -+
 O_xyderkes |   neu:  Arbeitsplatz   |   
 M_echanen  | http://domm.zsi.at/d/d162.html |
 M_asteuei  ++





Re: modperl 2

2002-06-09 Thread Thomas Klausner

Hi!

On Sun, Jun 09, 2002 at 12:42:15AM -0400, Jaberwocky wrote:
 Does any one know of any modperl 2 resources? mailing lists,
 stuff like that. 

mod_perl 2 issues are discussed here on the mod_perl mailing list

Please read this before posting:
http://perl.apache.org/release/maillist/email-etiquette.html

You'll find lots of documentation here: 
http://perl.apache.org/release/docs/index.html



-- 
 D_OMM  +  http://domm.zsi.at -+
 O_xyderkes |   neu:  Arbeitsplatz   |   
 M_echanen  | http://domm.zsi.at/d/d162.html |
 M_asteuei  ++





Re: DBI Bug

2002-06-03 Thread Thomas Klausner

Hi!

On Mon, Jun 03, 2002 at 03:40:57PM -0300, Udlei Nattis wrote:
 PerlModule DBI
 ..
 i test it in
 Apache 2.0/Perl 5.8.0RC1/Modperl 1.99.02/03
 Apache 2.0/Perl 5.7.3/Modperl 1.99.02/03
 Apache 2.0/Perl 5.6.1/Modperl 1.99.02/03
 Apache 2.0-cvs/All Perls/All Modperls

I'm not sure if Apache::DBI has already been ported to mod_perl 2.0

You could try to use Apache::compat

You DO know that mod_perl 2.0 is still in BETA and that you should use
mod_perl 1.27 in a production environment?


-- 
 D_OMM  +  http://domm.zsi.at -+
 O_xyderkes |   neu:  Arbeitsplatz   |   
 M_echanen  | http://domm.zsi.at/d/d162.html |
 M_asteuei  ++





Re: Invoke PHP scripts?

2002-05-29 Thread Thomas Klausner

Hi!

On Tue, May 28, 2002 at 09:48:14PM -0600, Ryan Thompson wrote:
 I'm developing a large-ish web site in which I would like to use a
 combination of mod_perl (90%) and PHP (10%). I have run into a
 roadblock trying to include the output of a PHP script from a mod_perl
 script.
As far as I know this is rather impossible with mod_perl 1.x

You can chain different perl handlers (but only perl handlers) using
Apache::Filter, or you could let your mod_perl application issue a real http
request (using LWP), parse the output, and then do what you want with it.

Apache 2.0 (and mod_perl 2.0) (both in BETA) can do what you want unsing
Filters.



-- 
 D_OMM  +  http://domm.zsi.at -+
 O_xyderkes |   neu:  Arbeitsplatz   |   
 M_echanen  | http://domm.zsi.at/d/d162.html |
 M_asteuei  ++





Re: Scripts and passwd

2002-05-20 Thread Thomas Klausner

Hi!

On Sun, May 19, 2002 at 10:34:17AM +0200, Per Einar Ellefsen wrote:
 At 10:22 19.05.2002, [EMAIL PROTECTED] wrote:
   I have written scripts to add a user to the passwd and shadow files as well
 as sendmail user files. When I run this script from the command line for
 testing all runs and completes fine. But when I run the script from apache
 via the web interface I designed it for, I get file permission errors on the
 additions to passwd and the rest of the scripts. How can I get the script to
 access those files?
 You're doing something pretty risky there. the passwd/shadow files are only 
 writable by root. So I suppose that when running them from the command line 

You could let the CGI(or mod_perl)-script write the new user info to a normal
file writable by Apache, and then run a root-owned script (via a cronjob)
that reads this file and then modifies the passwd/shadow file.

Depending on the frequency of the updates, you might want to add file
locking, and depending on the security of your whole system, you could add a
MD5 checksum to each entry, so that nobody with access to your filesystem
can add entries to the Apache-writable file.


-- 
 D_OMM  +  http://domm.zsi.at -+
 O_xyderkes |   neu:  Arbeitsplatz   |   
 M_echanen  | http://domm.zsi.at/d/d162.html |
 M_asteuei  ++





Re: Force a 404 error?

2002-05-16 Thread Thomas Klausner

Hi!

On Thu, May 16, 2002 at 11:40:49AM +0100, Jonathan M. Hollin wrote:
 Is it possible to force a 404-error from within a mod_perl CGI?
What about returning NOT_FOUND from your handler and let an ErrorDocument
print out the warning?

See Chapter 4, Handling Errors, in the Eagle book.

-- 
 D_OMM  +  http://domm.zsi.at -+
 O_xyderkes |   neu:  Arbeitsplatz   |   
 M_echanen  | http://domm.zsi.at/d/d162.html |
 M_asteuei  ++





[RFC] New Subject Tag for mod_perl 2.x postings

2002-05-06 Thread Thomas Klausner

Hi!

As there are more and more mod_perl 2.x related questions on the mailing
list, it would be a good idea to introduce a new subject tag (as in
http://perl.apache.org/email-etiquette.html#Tags
):

Something like:
[mod_perl 2.x]
[mp2]
[2x]
[2.x]
??

What do you think?

It would definitly keep my mailbox tidier...

Stas, If we decide on something I could patch the new documentation to
include this new tag, but I don't know abot the old (i.e. current) one


-- 
 D_OMM  +  http://domm.zsi.at -+
 O_xyderkes |   neu:  Arbeitsplatz   |   
 M_echanen  | http://domm.zsi.at/d/d162.html |
 M_asteuei  ++





Re: Make test issue with the URI module

2002-02-04 Thread Thomas Klausner

Hi!

On Sun, Feb 03, 2002 at 05:24:03PM -0800, Pierre Carette wrote:
 I am trying to install the latest version of Mod_perl (version 1.26) with
 Apache 1.3.23 on RedHat 7.2.
 
 When I tried the make test from the mod_perl installation I had an error
 saying that the module URI couldn't be found. I then downloaded and
 installed the URI module from cpan.org: URI-1.18 and now I get the following
 error:
 
 /usr/bin/perl t/TEST 0
 Can't locate object method new via package URI::URL at
 ../blib/lib/Apache/te
 st.pm line 252.
I ran into the same problem yesterday. I 'solved' it by adding
use URI::URL;
to blib/lib/Apache/test.pm

Does anyone know why this fails or how to fix it properly?

-- 
 D_OMM  +  http://domm.zsi.at -+
 O_xyderkes |   neu:  Arbeitsplatz   |   
 M_echanen  | http://domm.zsi.at/d/d162.html |
 M_asteuei  ++





Re: [QUESTION]PerlHandler and PerlLogHandler Phase

2002-02-01 Thread Thomas Klausner

Hi!

On Fri, Feb 01, 2002 at 10:24:24AM -0800, Mod Perl wrote:
 Here are the problems/Questions that I face:
 1. Since in this case each requests for a html file
 has multiple files that need to be downloaded by the
 client. Am I right to assume that the handler will act
 on each and every file requested file below my
 /en/course URI?
Add something like 
  return DECLINED unless $r-content_type() eq 'text/html';
near the top of your handler.

This way only html-documents get handled by your handler, the rest falls
through to the default apache handler.


-- 
 D_OMM  +  http://domm.zsi.at -+
 O_xyderkes |   neu:  Arbeitsplatz   |   
 M_echanen  | http://domm.zsi.at/d/d162.html |
 M_asteuei  ++



Re: disable mod_perl for certain virtual hosts/folders

2002-01-22 Thread Thomas Klausner

Hi!

On Tue, Jan 22, 2002 at 03:02:58PM +0100, [EMAIL PROTECTED] wrote:
 only pl-files are affected. Unfortunately I have some pl-files that
 must not run under mod_perl (even not under PerlRun cause they are
 really dirty) and I wonder if there is no way to set the orginal
 cgi-handler (that does not use mod_perl) for a certain
 location/virtual host.
 I thought this default-handler is cgi-script, but 
 
 SetHandler cgi-script
 
 in a virtual host does not do the trick.
What about 

Location /plain-cgi/
SetHandler cgi-script
Options ExecCGI
allow from all
/Location
 

-- 
 D_OMM  +  http://domm.zsi.at -+
 O_xyderkes |   neu:  Arbeitsplatz   |   
 M_echanen  | http://domm.zsi.at/d/d162.html |
 M_asteuei  ++





ANNOUNCE: CGI::URI2param 1.00

2002-01-07 Thread Thomas Klausner

Hi!

The URL

http://domm.zsi.at/source_code/modules/CGI-URI2param-1.00.tar.gz

has entered CPAN as

  file: $CPAN/authors/id/D/DO/DOMM/CGI-URI2param-1.00.tar.gz
  size: 4133 bytes
   md5: 2b216c471242e72dbcfc73059431756e

The main thing that changed is that I included Apache::URI2param, a
PerlInitHandler. 

From the README:

CGI::URI2param - convert parts of an URL to param values

DESCRIPTION

CGI::URI2param takes a request object (as supplied by CGI.pm or
Apache::Request) and a hashref of keywords mapped to
regular expressions. It applies all of the regexes to the current URI
and adds everything that matched to the 'param' list of the request
object.

Why?

With CGI::URI2param you can instead of:

 http://somehost.org/db?id=1234style=fancy
 
 present a nicerlooking URL like this:
 
  http://somehost.org/db/style_fancy/id1234.html
  
To achieve this, simply do:
  
   CGI::URI2param::uri2param($r,{
 style = 'style_(\w+)',
 id= 'id(\d+)\.html'
   });
   
Now you can access the values like this:
   
my $id=$r-param('id');
my $style=$r-param('style');
 
If you are using mod_perl, please take a look at Apache::URI2param.
It provides an Apache PerlInitHandler to make running CGI::URI2param
easier for you. Apache::URI2param is distributed along with
CGI::URI2param.


-- 
 D_OMM  +  http://domm.zsi.at -+
 O_xyderkes |   neu:  Arbeitsplatz   |   
 M_echanen  | http://domm.zsi.at/d/d162.html |
 M_asteuei  ++





Re: [modperl site design challenge] and the winner is...

2001-12-18 Thread Thomas Klausner

Hi!

On Tue, Dec 18, 2001 at 10:28:04PM +0800, Stas Bekman wrote:
 #  Design by Votes
 --
 1. Thomas Klausner  86
yeah!

 Since Thomas' design has won the gold, I suggest that we incorporate the
 constructive comments (attached) into his design, with David Harris'
 suggestion to apply on top the colors and some other bits from other
 ASF sites. Volunteers? 
I started it, so I guess I should finish it.

 Ideally if Thomas, Carlos and Allan could take
 the best of each other's work and produce the perfect design, that
That would be OK for me, Carlos, Allan??

-- 
 D_OMM  +  http://domm.zsi.at -+
 O_xyderkes |   neu:  Arbeitsplatz   |   
 M_echanen  | http://domm.zsi.at/d/d162.html |
 M_asteuei  ++





Re: mod_perl site challenge: proposal to use ASF site design

2001-12-17 Thread Thomas Klausner

Hi!

On Mon, Dec 17, 2001 at 04:17:02PM -0500, David Harris wrote:
As one of the three contributers I'd like to reply to some points you made:

 Thomas Klausner's isn't broken in anyway and acceptable, but I don't really
 *like* the page look very much.
The main goal of my proposial wasn't really to /look/ good (as I am not a
designer), but to be standard compiliant and fast loading and to make future
/design/ changes easy by strictly seperating structure (HTML) from style
(CSS).

 I propose that we simply use a site design that is the uniform
 psudo-standard for the Apache Software Foundation. A number of ASF
 projects are using this site design:
 http://www.apache.org/
 http://httpd.apache.org/
 http://jakarta.apache.org/
 http://www.apache.org/foundation/

I just took a brief look at those sites, and I think that they are
structurally somewhat different from the (new) mod_perl site. All those
sites are rather flat, i.e. there are no deep nested hierarchies like at the
mod_perl site (e.g.: Home / Documentation / mod_perl Developer's guide / )

We could maybe adopt their color scheme etc, but I think the mod_perl site
/will/ need some more navigational tools.

 (a) See if others also think that the three alternatives for a mod_perl site
 are not very desirable. If you agree, please speak up and say that you
 agree.
Just to defend my submission: All coloring, positioning, fonts, box layout
etc is done in one CSS file that can easily be made nicer-looking. I
basically just separated the structure from the styling, so that anybody who
feels so inclined can do a nicer styling more easily.

 (c) Perhaps elicit a volunteer to design an example site that includes Stas'
 content and the ASF generic design. If enough people agree with the first
 two points, someone may be willing to volunteer to do this.. perhaps even
 one of the existing contributors who have already figured out DocSet.
 Perhaps even Stas!
I think it would be quite easy to modify my submission to look like the ASF
sites, but some navigational issues will have to be solved.

For Example, I think that the NavBar on the top of the page, that shows
where in the site you currently are and provides links to the upper levels
is absolutely necessery. The prev/next links are quite nice, but not that
important IMO. 

-- 
 D_OMM  +  http://domm.zsi.at -+
 O_xyderkes |   neu:  Arbeitsplatz   |   
 M_echanen  | http://domm.zsi.at/d/d162.html |
 M_asteuei  ++





Re: RFC: CGI vs. Apache Namespace Question

2001-12-16 Thread Thomas Klausner

Hi!

On Wed, Dec 12, 2001 at 01:44:52PM -0500, darren chamberlain wrote:
 I didn't even think of that; if Apache is not installed, having
 URI2Param.pm in site_perl/Apache doesn't matter.  Therefore, I
 would like to resubmit option 5:
 
   5)  Include Apache::URI2Param with the CGI::URI2Param module
   that gets installed along with CGI::URI2Param, where
   Apache::URI2Param calls CGI::URI2Param::uri2param.

A great idea, I'll make it so!

Thanks 

BTW, sorry for the long delay, but the combination of arctic temperatures
(-15 deg. Celsius) in Vienna and me still riding my bike resulted in some
sort of flu. But now I am well again ...

-- 
 D_OMM  +  http://domm.zsi.at -+
 O_xyderkes |   neu:  Arbeitsplatz   |   
 M_echanen  | http://domm.zsi.at/d/d162.html |
 M_asteuei  ++





RFC: CGI vs. Apache Namespace Question

2001-12-11 Thread Thomas Klausner

Hi!

I've got a small CPAN Namespace Question:

Some time ago I wrote CGI::URI2param (
http://search.cpan.org/search?mode=modulequery=URI2param
).

Now, thanks to an idea by darren chamberlain, I wrote a small
PerlInitHandler that does nothing more than parse some PerlSetVars and then
call uri2param(). But still it is very convienient to use it like this.

So should I:
1* put the Apache Handler into CGI::URI2param, which maybe is some sort of
Namespace violation (you'd have to say 
  PerlInitHandler CGI::URI2param
in httpd.conf)
  
2* create a new module, Apache::URI2param, which only contains the config
parsing stuff and requires CGI::URI2param. This would result in two small
modules cluttering CPAN, where one of those (Apache::URI2param) is useless
without the other

3* dump CGI::URI2param in favour of Apache::URI2param, which wouldn't make
much sense either, because the code does not depend on mod_perl (and not
even on Apache)

4* let the users write there own handlers

I tend to use solution 1, but if you would like to comment on this, I would 
really appreciate some feedback!


-- 
 D_OMM  +  http://domm.zsi.at -+
 O_xyderkes |   neu:  Arbeitsplatz   |   
 M_echanen  | http://domm.zsi.at/d/d162.html |
 M_asteuei  ++





[modperl-site design challenge] Thomas Klausner (domm)

2001-11-25 Thread Thomas Klausner

Hi!

You can look at my idea of the the new modperl-site design here:
http://domm.zsi.at/modperl-site-domm/

You can get the whole distro to download at:
http://domm.zsi.at/modperl-site-domm/modperl-site-domm.src.tgz
or just the output at:
http://domm.zsi.at/modperl-site-domm/modperl-site-domm.dst.tgz

Some Notes:

* The first page (Home) successfully validates at w3.org (HTML and CSS).

* While the design might not be to cool from the designers point of view, I
like it because it is simple, doesn't use HTML-tables, is small and fast
(/very/ little HTML-overhead) and accessible to disabled people.

* The colours could be changed very easily, as they are only defined in
default.css

* I tested it with Mozilla, Opera and Lynx on Linux; Netscape 4.something
and IE 6.0 on WinME;
It worked very well on everything exept Netscape (because Netscpae 4's CSS
handling is absolutly horrible!), but it was still usable on Netscape 4 (and
looked OK with CSS turned off).


-- 
 D_OMM  +  http://domm.zsi.at -+
 O_xyderkes |   neu:  Arbeitsplatz   |   
 M_echanen  | http://domm.zsi.at/d/d162.html |
 M_asteuei  ++





Re: [modperl-site design challenge] Thomas Klausner (domm)

2001-11-25 Thread Thomas Klausner

Hi!

On Mon, Nov 26, 2001 at 01:36:07AM +0100, Robin Berjon wrote:
  * The first page (Home) successfully validates at w3.org (HTML and CSS).
 That's very good. Do the others validate as well (or at least, do you see any 
 reason why they wouldn't ?) ?
On some of the deeper pages, Pod::POM generates HTML like this:
 ul
 text
 /ul
 
This isn't valid HTML (according to W3C), so those pages won't validate
successfully. 
e.g:
http://domm.zsi.at/modperl-site-domm/download/binaries.html

Another problem Stas pointed out is with pages containing preformatted text
(pre Tags), e.g. here:
http://domm.zsi.at/modperl-site-domm/docs/devel/writing_tests/writing_tests.html
If somebody knows a nice solution to this problem (pre-text flowing out of
the containing box), please drop me a note!


  It worked very well on everything exept Netscape (because Netscpae 4's CSS
  handling is absolutly horrible!), but it was still usable on Netscape 4
  (and looked OK with CSS turned off).
 Netscape 4 isn't a web browser ... Everyone knows it's the 
 only piece of software ever concieved that makes Windows 95 look bug free in 
 comparison.
:-)

-- 
 D_OMM  +  http://domm.zsi.at -+
 O_xyderkes |   neu:  Arbeitsplatz   |   
 M_echanen  | http://domm.zsi.at/d/d162.html |
 M_asteuei  ++





Re: [challenge] new mod_perl site

2001-11-14 Thread Thomas Klausner

Hi!

On Wed, Nov 14, 2001 at 01:31:52AM +0800, Stas Bekman wrote:
 Obviously the site should be very light on graphics, but since you are
 a good web designer you know this and all the other requirements
 already. The only requirement we have is that this is an information
 site, so avoid fancy graphics and god forbid flash splashes :)

What about an additional requirement:

The site should be validated sucessfully by validator.w3.org

(The current design doesn't, BTW)

I know that it is hard to get a page validated there, but IMO there should
be more clean/standard-compatible websites. I guess you all know the
reasons for this, so I won't repeat them here.  

Anyway, I think I will give it a try ...

-- 
D_OMM
O_xyderkes
M_echanenhttp://domm.zsi.at
M_asteuei



Re: [challenge] new mod_perl site

2001-11-13 Thread Thomas Klausner

Hi!

On Wed, Nov 14, 2001 at 01:31:52AM +0800, Stas Bekman wrote:
 Obviously the site should be very light on graphics, but since you are
 a good web designer you know this and all the other requirements
 already. The only requirement we have is that this is an information
 site, so avoid fancy graphics and god forbid flash splashes :)

What about an additional requirement:

The site should be validated sucessfully by validator.w3.org

(The current design doesn't, BTW)

I know that it is hard to get a page validated there, but IMO there should
be more clean/standard-compatible websites. I guess you all know the
reasons for this, so I won't repeat them here.  

Anyway, I think I will give it a try ...

-- 
D_OMM
O_xyderkes
M_echanenhttp://domm.zsi.at
M_asteuei



[OT] Re: Excellent article on Apache/mod_perl at eToys

2001-10-19 Thread Thomas Klausner

Hi!

On Fri, Oct 19, 2001 at 09:59:18AM -0400, Drew Taylor wrote:
 What I found most interesting was the detail of the extensive caching which 
 was implemented to survive the seasonal rush.
Wasn't this seasonal rush at least partly caused by the so-called toywar
(www.toywar.com) between eToys.com (the online retailer) and etoy.com
(the art group)?

As far as I remember this incident, eToys.com sued etoy.com (who were
holding this domain since 1994) because of trademark delusion etc., which
caused one of the first distrubuted DOS attacks against etoys.com.

see:
http://rtmark.com/etoymain.html


-- 
D_OMM
O_xyderkes
M_echanenhttp://domm.zsi.at
M_asteuei



Re: Pre-announce Apache::ConfigParser

2001-09-14 Thread Thomas Klausner

Hi!

 I swore there was yet a third candidate in this realm, but I didn't see it
 on brief inspection.
I am currently sort of working (haven't touched for some time) on
something called Apache::FakeEnv which should be something like a subclass of
Apache::FakeRequest, but which includes access to stuff defined in Apache
Config Files.

I am now using Config::General to parse the config file, which works, but
as Config::General doesn't handle eg. PerlSetVar in the way I need it, I
have to do some dirty tricks to use the data structure returned from
Config::General

A feature I would really like to see (or implement myself in some combined
verions of the various Config parsers) is a way to take a parsed config
and an URL and to get all values that apply to this URL

eg:

Location /test/
PerlSetVar foo bar
PerlSetVar baz bla
/Location

LocationMatch something
PerlSetVar foo NotBar
/LocationMatch

$conf-requested_uri('http://host/test/somehting/');

print $conf-dir_config('foo');   # prints 'NotBar'
print $conf-dir_config('baz');   # prints 'bla'

So, if there will be an Unified Apache Config Parsing Module, I would like
to implement this feature (if it's not allready there ...)

domm





ANNOUNCE: CGI::URI2param 0.03

2001-07-05 Thread Thomas Klausner

Hi!

The uploaded file

CGI-URI2param-0_03.tar.gz

has entered CPAN as

  file: $CPAN/authors/id/D/DO/DOMM/CGI-URI2param-0_03.tar.gz
  size: 2858 bytes
   md5: 059f7b717e5b746a1ecde3fc12fb32d5

This is the first public release.

DESCRIPTION:
CGI::URI2param takes a request object (as supplied by CGI.pm or
Apache::Request) and a hashref of keywords mapped to
regular expressions. It applies all of the regexes to the current URI
and adds everything that matched to the 'param' list of the request
object.

Why?

With CGI::URI2param you can instead of:

 http://somehost.org/db?id=1234style=fancy

present a nicerlooking URL like this:

 http://somehost.org/db/style_fancy/id1234.html

To achieve this, simply do:

 CGI::URI2param::uri2param($r,{
style = 'style_(\w+)',
id= 'id(\d+)\.html'
   });

Now you can access the values like this:

 my $id=$r-param('id');
 my $style=$r-param('style');


--
D_omm
O_xyderkes http://domm.zsi.at
M_echanen
M_asteuei



RFC: CGI::URI2param (was: handler question)

2001-07-04 Thread Thomas Klausner

Hi!

darren chamberlain [EMAIL PROTECTED]:
 How is it different from mod_rewrite using the QSA flag to add
 values to r-args? (This is a question, not a criticism!)
True, you could use mod_rewrite to get the same result, but there 
are situations where you can't use it, e.g. you're not working with 
Apache, or your ISP won't install mod_rewrite ...

And thanks for the various namespace suggestions! I think I will 
name it CGI::URI2param
I think the CGI namespace is better suited, because this module 
isn't Apache-specific, although it /can/ be used with mod_perl.

I just submitted it to PAUSE, so it may take a while until it appears 
on CPAN, but you can get it in the meantime at:
http://domm.zsi.at/CGI-URI2param-0_03.tar.gz

It is nicely packed and documented (!)


  
--
D_omm
O_xyderkes http://domm.zsi.at
M_echanen
M_asteuei



Re: handler question

2001-07-03 Thread Thomas Klausner

Hi!

On 3 Jul 2001, at 15:21, Viljo Marrandi wrote:
 Actually i thought about r-uri. It returns everything after servername 
 and if i split it using '/' as separator i think i'm almost there ;o). 
I have a nearly finished module which applies some regular 
expression (specified in some config file) to the URI and puts the 
stuff it found into $r-param (that means you have to use CGI or 
Apache::Request to use it).

e.g: http://www.somehost.org/stuff/order_byname/id0099.html
Regexes:
order='order_(\w+)'
id='id(\n+)\.html'

After running the URL through my module you could get at the id 
with $r-param('id')

If you're interested, I could send it to you ...

BTW, if anybody else is interested in this module, I could put it on 
CPAN (after deciding on a Namespace etc)


--
D_omm
O_xyderkes http://domm.zsi.at
M_echanen
M_asteuei



Re: RFC: new module: Apache::FakeEnv

2001-06-25 Thread Thomas Klausner

Hi!

Geoffrey Young:
there was a more advanced Apache::FakeRequest floating around 
somewhere...

I think this was it, but I swore it was something on the dev@ list:
http://marc.theaimsgroup.com/?l=apache-
modperlm=98719810927157w=2
I knew this script (it was posted here, too), and while it is definitly 
better than Apache::FakeRequest, it still doesn't handle dir_config 
calls.

Geoffrey Young:
generally, I would think that feature enhancements to
Apache::FakeRequest would be preferred over another module
that is essentially the same - a better FakeRequest has been on 
the ToDo list for some time now...

any chance you can expand the existing Apache::FakeRequest
and offer a patch?
Sure I could try to patch Apache::FakeRequest, but I think the 
changes are quite fundamental. What to the mantainers of 
Apache::FakeRequest (or mod_perl) think of this?


darren chamberlain:
Don't know about the rest, but I saw Config::General, which will
parse an Apache config file into a hash. Very useful, and very
well done.
I took a look at this module, and while it parses simple Apache 
config files correctly, it won't work with more complex ones. For 
example, it doesn't handle Include directivec (altough I submitted a 
patch to the author, so it will work with Apache Includes) and it 
can't parse VirtualHost Sections correctly.

This questions of my initial posting are still unanswered:

* Is it possible to subclass mod_perl or Apache::Request from 
outside of Apache (i.e. in a plain perl environment) ?

* If not (which it seems to be), what would be the best way to 
implement all (more or less..) mod_perl methods and subclasses 
(Apache::Request et.al) ? Can one use the C code that mod_perl 
is based on? (Well, I guess I can't because I've never done any real 
C coding ...) ?


--
D_omm
O_xyderkes http://domm.zsi.at
M_echanen
M_asteuei



RFC: new module: Apache::FakeEnv

2001-06-20 Thread Thomas Klausner

Hi!

I am currently working on a module that generates a Fake Apache 
Request Object like Apache::FakeRequest does, but that also 
parses the Apache Configuration and enables the user to access 
values set with PerlSetVar (i.e. fake $r-dir_config).

This Request Object can than be used in mod_perl modules, when 
running from the command line.

I have a first (sort of) working version at:
http://domm.zsi.at/source_code/Apache-FakeEnv.pm
and the documentation at:
http://domm.zsi.at/Apache-FakeEnv.html
or embedded in Apache-FakeEnv.pm in pod-format

This module has some limitations (see Section Limitations in the 
doc) that I would like to remove, but I'm not sure how, so ...

* Is it possible to subclass mod_perl or Apache::Request from 
outside of Apache (i.e. in a plain perl environment) ?

* If not (which it seems to be), what would be the best way to 
implement all (more or less..) mod_perl methods and subclasses 
(Apache::Request et.al) ? Can one use the C code that mod_perl 
is based on? (Well, I guess I can't because I've never done any real 
C coding ...) ?

* Does a parser for the Apache Conifg Files exist somewhere 
(Parse::ReDescent or similar) or can one use the Apache Source 
Code or Apache itself to parse the config  ?

* Do you think that this module could be of interest to others 
(Should I put it on CPAN) ?

Thanks for your attention !


--
D_omm
O_xyderkes http://domm.zsi.at
M_echanen
M_asteuei



new module

2000-11-13 Thread Thomas Klausner

Hi!

I am currently developing a perl module that is somewhat simmilar 
to CGI::PathInfo, and somewhat not. (IMO more not).

The module would be used in a CGI- or mod_perl-environment. It 
takes the path-info (or the whole URL) and performs some regular 
expressions (defined via some configuration) on it. If the regular 
expressions match, the value will be added to $q-param

Example:
URI: /somewhere/on/server/o_date/id1234.html

%config={
  order_by='o_(\w+)'   ,
  id='id(\d+)'   ,
};

# code (simplified !!)
   while(my($key,$regex)=each(%config)) {
  if ($pathinfo=~/$regex/) {
 $q-param($key,$+);
  }
   }

after this code, $q-param('id') holds "1234" and 
$q-param('order_by') holds "date"

Do you think this module would be useful for others?
If so, I will try to put in on CPAN.

I am thinking of naming the module CGI::PathInfoRegex or 
Apache::PathInfoRegex. Which name is better suited (or should I 
choose a totally difrent name?)

The whole module (definitly alpha code) can be found at :
http://domm.zsi.at/PathInfoRegex-0.01.tar.gz


-- 
D_OMM  http://domm.zsi.at
O_xyderkes
M_echanenNEU (naja): Wohnungs-Historie
M_asteuei http://domm.zsi.at/curvit/wohnen.html



Re: Passing data structures between Stacked Handlers

2000-11-12 Thread Thomas Klausner

Hi!

 If you use $r-pnotes, you can just put a reference to an arbitrary data
 structure into it and it will still be there in the next handler.  No
 need to serialize it with Data::Dumper.  Better than using a normal
 global because it gets automatically cleaned up after the request.
Thanks for the info.

Ken Williams [EMAIL PROTECTED] also told me that 
$r-pnotes wasn't included in the Eagle Book because it (pnotes, 
not the book) wasn't implemented then. The old problem with 
books.


-- 
D_OMM  http://domm.zsi.at
O_xyderkes
M_echanenNEU (naja): Wohnungs-Historie
M_asteuei http://domm.zsi.at/curvit/wohnen.html



Passing data structures between Stacked Handlers

2000-11-11 Thread Thomas Klausner

Hi!

Is there a module that can do "Stacked Handler Pipelining", but 
doesn't pass around tied filehandles but data structures ?

If there isn't, could it be implemented by dumping the data 
structure to $r-notes (with Data::Dumper) and have it eval'ed back 
by the next handler?


-- 
D_OMM  http://domm.zsi.at
O_xyderkes
M_echanenNEU (naja): Wohnungs-Historie
M_asteuei http://domm.zsi.at/curvit/wohnen.html



Aborting Apache startup during PerlInitHandler

2000-07-23 Thread Thomas Klausner

Hi!

I have got a PerlInitHandler that does some config parsing etc.

I would like Apache to stop starting up and to print out some error
message ("Config Directive blabla missing" or something like that) if
an error occures during config parsing. (As it is happing when
something is wrong with the Apache Config (httpd.cfg ...))

How can this be done?
-- 
D_OMM  http://domm.zsi.at
O_xyderkes
M_echanenNEU: Evolution meines Musikgeschmackes
M_asteuei http://domm.zsi.at/curvit/musik.html