Re: Apache::Session and pnotes

2003-09-05 Thread Enrico Sorcinelli
On Tue, 2 Sep 2003 20:21:45 +0200
Xavier Noria [EMAIL PROTECTED] wrote:

 On Tuesday 02 September 2003 07:28, Perrin Harkins wrote:
 
  Sorry, I don't understand what you're saying here.  What you should
  be doing is fetching the session once, putting it in pnotes, and
  getting it from pnotes for the rest of the request.
 
 I am sorry, I'll try to reword it.
 
 Let's assume a new user comes to the website. We set up a session for 
 him and put the session id in a cookie to be sent in the response. As 
 you know, somewhere in the request cycle of that particular request 
 Apache::Session::Oracle stores the session in the database.
 
 When later that very user comes back to the website with a valid session 
 id in the cookie, one reads the session from the database.
 
 The problem I am facing is that if the session is stored in pnotes() it 
 doesn't end up in the database. When the user comes back that id 
 corresponds to no row in the sessions table.
 

Hi Xavier,

If you want a transaparent session management you could also look 
Apache::SessionManager
mod_perl extension. No extra code to write but a few lines to add in httpd.conf or
.htaccess.file

:-)

by

- Enrico


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



[ANNOUNCE] Apache::SessionManager 0.06

2003-07-28 Thread Enrico Sorcinelli
The uploaded file

Apache-SessionManager-0.06.tar.gz

has entered CPAN as

  file: $CPAN/authors/id/E/EN/ENRYS/Apache-SessionManager-0.06.tar.gz
  size: 20944 bytes
   md5: 8e5332438deedd67ca71d5c3536ebb98

Changes from previous version
-
   ! Removed an exit() command from Makefile.PL in order to work with 
 cpan/cpanplus shell when auto-installing required modules
   ! Update NAME section in cookpod to Apache::SessionManager::cookpod
   ! Minor corrections to cookpod 
   ! Uncommentend __END__ line in SessionManager.pm - why it was commented? :-)

See perldoc Apache::SessionManager for module documentation and use
See perldoc Apache::SessionManager::cookpod for more info about module use

Any comment and/or criticism are welcome :-)

by

- Enrico


[ANNOUNCE] Apache::SessionManager 0.05

2003-07-14 Thread Enrico Sorcinelli
The uploaded file

Apache-SessionManager-0.05.tar.gz

has entered CPAN as

  file: $CPAN/authors/id/E/EN/ENRYS/Apache-SessionManager-0.05.tar.gz
  size: 20891 bytes
   md5: 59a42fa50c52871843f50ae8e820e5a7

Changes from previous version
-
   + Added syntax control over SessionManagerExpire directive. An explicit
 '0'value means no expiration time (if undefined the default value is
 3600)
   + Added syntax control over SessionManagerInactivity directive
   + Removed dependency from Apache::Cookie. CGI::Cookie will be used
 instead of Apache::Cookie if libapreq aren't installed
   + Added Apache::SessionManager::cookpod HOWTO (it explains use of 
 Apache::SessionManager with several application servers and toolkits
 available designed to run (also) under mod_perl like TT2,
 CGI::Application, PLP, Mason, ecc)
   + Added PLP.pm patch (patches/PLP-3.18.patch) to add direcly $session
 into PLP Perl embedder
   + Added patch (patches/Apache-Session-1.54-patch) for
 Apache::Session::Lock::File
   + Added authentication test handler t/lib/MyAuth.pm to show how
 Apache::SessionManager can work with authentication (see perldoc
 Apache::SessionManager::cookpod)
   ! Modified test handler t/lib/PrintEnv.pm to print $session dump
   ! Updated module docs, added sections
   ! Updated test and docs   

See perldoc Apache::SessionManager for module documentation and use
See perldoc Apache::SessionManager::cookpod for more info about module use

Any comment/criticism are welcome :-)

by

- Enrico



Re: Apache::Session::Lock::File hangs under Windows

2003-07-08 Thread Enrico Sorcinelli
On Tue, 8 Jul 2003 10:26:54 +0400
Andrew Alakozow [EMAIL PROTECTED] wrote:

Hi Andrew

 
 BTW, 'clean' method of this model hangs as well.
 

Also Apache::Session::Lock::File (1.54) 'clean' method has a little bug in 
checking lockfiles last access time.

See my post at:

http://mathforum.org/epigone/modperl/plinfrargoo

Since I've mailed this to the author with no response, I'll include the 
patch into my next release of Apache::SessionManager (A::S wrapper).

by

- Enrico


Re: [RFC] web-messaging application for mod_perl

2003-07-01 Thread Enrico Sorcinelli
On Mon, 30 Jun 2003 12:57:00 -0700
Adi Fairbank [EMAIL PROTECTED] wrote:

 Apache::WebMessaging
 
 I am about ready to release an intraserver web-messaging application for
 mod_perl.  A brief description of the app follows; I'd like to hear some
 comments from the mod_perl/Perl/P5EE community on:

You could look about Apache::* modules naming conventions:

http://perl.apache.org/products/apache-modules.html#Module_Naming_Conventions

Apache::App::WebMessaging namespace could be a right place :-)

by

- Enrico


[ANNOUNCE] Template::Plugin::Apache::SessionManager 0.01

2003-06-23 Thread Enrico Sorcinelli
Hi all,

I'm glad to announce first public release of
'Template::Plugin::Apache::SessionManager' module.

Template::Plugin::Apache::SessionManager - Session manager Template Toolkit 
plugin
This Template Toolkit plugin provides an interface to Apache::SessionManager
module wich provides a session manager for a web application.  This module
allows you to integrate a transparent session management into your TT2 template
documents (it handles for you the cookie/URI session tracking management of a
web application)
 
You can download it from CPAN:

   
http://www.cpan.org/authors/id/E/EN/ENRYS/Template-Plugin-Apache-SessionManager-0.01.tar.gz

I've send this announce to mod_perl ML because it's possible to use it with 
Apache::Template mod_perl module wich provides a simple interface to the
Template Toolkit allowing Apache to serve directly TT2 files.

SYNOPSIS
  [% USE my_sess = Apache.SessionManager %]
 
  # Getting single session value
  SID = [% my_sess.get('_session_id') %]
 
  # Getting multiple session values
  [% FOREACH s = my_sess.get('_session_id','_session_timestamp') %]
  * [% s %]
  [% END %]
  # same as
  [% keys = ['_session_id','_session_timestamp'];
 FOREACH s = my_sess.get(keys) %]
  * [% s %]
  [% END %]
 
  # Getting all session values
  [% FOREACH s = my_sess.get %]
  * [% s %]
  [% END %]
 
  # Setting session values:
  [% my_sess.set('foo' = 10, 'bar' = 20, ...) %]
 
  # Deleting session value(s)
  [% my_sess.delete('foo', 'bar') %]
  # same as
  [% keys = ['foo', 'bar'];
 my_sess.delete(keys) %]
 
  # Destroying session
  [% my_sess.destroy %] 


For detailed module info, see:

perldoc Template::PLugin::Apache::SessionManager

by

- Enrico



Re: cookie setting/retieval

2003-03-31 Thread Enrico Sorcinelli
On Mon, 31 Mar 2003 18:11:21 -0600
Jason Jolly [EMAIL PROTECTED] wrote:

 I'm currently in the process of writing a wrapper for a site using Apache::Session 
 and mod_perl.  I was having great success using the following code to either 
 validate a cookie which was already present or set a new cookie if necessary:

Hi Jason, 
don't reinvent the wheel! ;-)
There's already an Apache::Session wrapper on CPAN called Apache::SessionManager. 
Apache::SessionManager is a mod_perl module that helps session management of a 
web application. It creates a session object and makes it available to all 
other handlers transparenlty. Also session expiration policies are available.

http://cpan.org/modules/by-module/Apache/Apache-SessionManager-0.04.tar.gz

See perldoc Apache::SessionManager for more infos.

by

- Enrico


Re: Server side programming PHP Vs CGI Vs modPerl

2003-02-14 Thread Enrico Sorcinelli
On Fri, 14 Feb 2003 15:52:35 +0530 (IST)
Devi .M [EMAIL PROTECTED] wrote:

 Hello all,
   Thanks for all ur reponses. With all ur suggestions and
 comparisons, I have decided to use mod_perl [...]

Good! ;-)

   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?
 

As you've read, currently Apache::Session is not shipped with mod_perl and 
have to be installed separately.
Apache::Session is a persistence framework for session data. He not handles 
web sessions for you. For a transparent management you can:

1. Use an existent application server mod_perl-based that offers this
   capability like Apache::ASP, Ax-Kit, HTML::Mason or HTML::Embperl, etc...

2. If you prefer to write your own mod_perl modules, you can use 
Apache::SessionManager, 
   a mod_perl module that helps session management of a web application by 
   creating session object and making it available to all other handlers 
   transparenlty (you can found it on CPAN). It is a wrapper around 
   Apache::Session.

By

- Enrico



RE: Apache::SessionManager pnotes index.html problem...

2003-01-29 Thread Enrico Sorcinelli
Hi Joseph,



Thanks Enrico, I had no idea that was the problem.  My case is
http://yourserver.com/


As I have already said to you in the previous post, the problem is that
currently, Apache::SessionManager skips all subrequests.
When you request http://yourserver.com/, Apache do it because you've
defined the 'DirectoryIndex' directive and no session starts.


Anyway to make this appear in the documents?  I would be
happy to apply a patch for you and resend you source for 
Apache::SessionManager
with this documnented?

Thanks. I'm upgrading the docs with these additional notes but you're
encouraged to send me all your suggestions and troubles!


 Your configuration seems to be bizarre...! ;-)
 As I have answered to you in a previous personal post, if you want to use
 Apache::SessionManager with the Directory directives (and you do not want
 to put the PerlSetVar SessionManager* directives in httpd.conf's global 
scope,
 of course), you can install it in the header_parser phase by putting

Enrico, my fault.  It was late and i just wanted to get the out a sample 
to the
mailing list.  I thought it was mod_perl problem and couldn't fault
Apache::SessionManager directly so I thought it best not to bother you again
personally. ;-)

There is no fault ;-)
I think that there are (at least) two places where to speak over the
modules related to mod_perl:

 o the mod_perl mailing list
 o the newsgroups (comp.lang.perl.modules, comp.lang.perl.misc).

Currently Apache::SessionManager hasn't own mailing list, so this list
can be a good place.

- Enrico




Re: Apache::SessionManager pnotes index.html problem...

2003-01-23 Thread Enrico Sorcinelli
On Wed, 22 Jan 2003 22:21:20 -0700
Joseph P. Crotty [EMAIL PROTECTED] wrote:

 Here is the simplest form of the problem I can produce.
 
 I have two handlers and want to pass some info between them visa vi pnotes.  One
 is a PerlTransHandler for Apache::SessionManager and the other is a PerlHandler
 for a simple Hello.pm that dumps some html with the current _session_start value
 (i.e. from pnotes).  Apache::SessionManager checks to see if a session file
 exists, creates one if not, and updates pnotes appropriately.
 
 The problem - if I request index.html there is no value in pnotes for
 _session_start as confirmed by Hello.pm.  

Hi Joseph,
I have a little question. You request:

http://yourserver.com

or:

http://yourserver.com/index.html

?

Note that in first case Apache can do an internal subrequest to 
file(s) defined by the DirectoryIndex directive.
Currently, Apache::SessionManager skips all subrequests.
Otherwise, the second URL works fine.

It seems that there is nothing in
 pnotes period.  If after the request I manually inspect the session file created
 I find a value for _session_start.  Request other pages (e.g. test.html) and
 there are expected pnotes entries confirmed by Hello.pm.
 

For the URI ending with a slash, you can this workaround by putting this line 
in your http.conf:

RedirectMatch (.*)/$ $1/index.html

 Apache 1.3.27 mod_perl
 
 httpd.conf snippet
 #START mod_perl Configuration
 #
 PerlRequire conf/startup.pl
 PerlSetEnv  MOD_PERL_TRACE all
 
 PerlSetEnv  SERVER_ROOT /usr/local/apache/
 #--
 #END mod_perl Configuration
 
 
 #START Apache::SessionManager Configuration
 #--
 PerlModule Apache::SessionManager
 PerlTransHandler Apache::SessionManager
 #
 #END Apache::SessionManager Configuration
 
 
 #START Block Directives
 #--
 Location /
 SetHandler perl-script
 PerlSetVar SessionManagerDebug 0
 PerlSetVar SessionManagerTracking On
 PerlSetVar SessionManagerExpire 3600
 PerlSetVar SessionManagerStore File
 PerlSetVar SessionManagerStoreArgs Directory =
 /usr/local/apache/session, \
 LockDirectory =
 /usr/local/apache/session/lock
 /Location
 
 Directory /usr/local/apache/htdocs
 Files ~ index.html$
 SetHandler perl-script
 PerlHandler MyApache::Hello
 /Files
 
 Files ~ test.html$
 SetHandler perl-script
 PerlHandler MyApache::Hello
 /Files
 /Directory
 

Your configuration seems to be bizarre...! ;-)
As I have answered to you in a previous personal post, if you want to use 
Apache::SessionManager with the Directory directives (and you do not want 
to put the PerlSetVar SessionManager* directives in httpd.conf's global scope,
of course), you can install it in the header_parser phase by putting a line like
this:

PerlHeaderParserHandler Apache::SessionManager

in global, VirtualHost, Directory, Location, .htaccess sections of your 
httpd.conf file. For example:

---CUT HERE---
PerlModule Apache::SessionManager 
Directory /usr/local/apache/htdocs
   FilesMatch \.html$
  SetHandler perl-script
  PerlHandler MyApache::Hello

  PerlHeaderParserHandler Apache::SessionManager
  PerlSetVar SessionManagerTracking On
  PerlSetVar SessionManagerExpire 3600
  PerlSetVar SessionManagerInactivity 900
  PerlSetVar SessionManagerName MYPELRSESSIONID
  PerlSetVar SessionManagerStore File
  PerlSetVar SessionManagerStoreArgs Directory = /tmp/apache_session_data/
  PerlSetVar SessionManagerDebug 5
   /FilesMatch
/Directory  
---CUT HERE---

If you need session URI tracking, you must accept the compromise...:
the PerlTransHandler phase with Location directive. This is a configuration
example to run all the /cgi-bin executable scripts over Apache::Registry
with session ID URI rewriting:

---CUT HERE---
PerlModule Apache::SessionManager
PerlTransHandler Apache::SessionManager
Alias /perl/  /usr/local/apache/cgi-bin/
LocationMatch ^/([0-9a-h]+/)?perl
   SetHandler perl-script
   PerlHandler Apache::Registry
   PerlSendHeader On
   PerlSetupEnv   On
   Options ExecCGI
 
   PerlSetVar SessionManagerTracking On
   PerlSetVar SessionManagerURITracking On
   PerlSetVar SessionManagerExpire 3600
   PerlSetVar SessionManagerInactivity 1800
   PerlSetVar SessionManagerName MYPELRSESSIONID
   PerlSetVar SessionManagerStore File
   PerlSetVar SessionManagerStoreArgs Directory = /tmp/apache_session_data/
   PerlSetVar SessionManagerDebug 5
/LocationMatch
---CUT HERE---


by

- Enrico




Re: sesion managing

2003-01-07 Thread Enrico Sorcinelli
On Mon, 30 Dec 2002 09:46:41 +
koudjo ametepe [EMAIL PROTECTED] wrote:

 hi everbody ,
 How do you do
 I developping an intranet project with perl and Mysql .
 I encounter a problem and still i haven't found a solution .The problem is
 previously i was using php/mysql ; with the function sesssion_xxx i was able to keep 
user id through all the pages and store it any time that the user save something in 
the database .
 Umfortunately i don't know how to do this with perl , i read some articles on the 
net about it but i get nothing.
 Please can you give me some ideas about the session managing in perl/mysql
 thanks
 koudjo

Hi,
if you use mod_perl, you can look at:

http://search.cpan.org/author/ENRYS/Apache-SessionManager-0.04/

a mod_perl extensions that manage sessions tansparently for you.
It uses Apache::Session::* modules as persistence framework for session data.
Then you can use all datastores supported by Apache::Session (file, MySQL, Postgres,
Sybase, Oracle, DB_File, RAM, PHP-like file)

Bye

- Enrico Sorcinelli





Re: Session managing using PerlTransHandler

2002-11-22 Thread Enrico Sorcinelli
On Fri, 22 Nov 2002 19:09:25 +0200
[EMAIL PROTECTED] wrote:

 How I Can redirect to page http://foo.bar/ses1/index.html from  PerlTransHandler 
Module?

Hi,
the description of your problem is very... short.
The chapter 5 of 'eagle' book explain how to put and strip session ID
on the left to the left of the URI.

Moreover, the Apache::SessionManager module does things transparently for you.
It works in PerlTransHandler phase.
(http://www.cpan.org/modules/by-module/Apache/Apache-SessionManager-0.04.tar.gz)

Bye

- Enrico
 




Re: New module : Apache::Session::Manager

2002-11-18 Thread Enrico Sorcinelli
On 16 Nov 2002 13:24:13 +0200
Clinton Gormley [EMAIL PROTECTED] wrote:

 I've written a new module as a wrapper around Apache::Session which
 provides short term (ie session) tracking (which is something that
 Apache::SessionManager and Apache::SessionX provide), but this adds long
 term user tracking, and methods to aid login, logout etc.
 
 
 I would appreciate feedback, not least of all, what it should be
 called!  Apache::SessionManager exists already, and I realise that
 calling this module Apache::Session::Manager will cause confusion, so
 please...

Dear Clinton,
I think that the name you've chosen (Apache::Session::Manager) is wrong :-(
not because it will cause confusion with my Apache::SessionManager module,
but because Apache::Session::* namespace is informally reserved to
Apache::Session sub components like data storage, serializers or ID 
generators. Your (and my, of course) session manager module 
hasn't any relationships with these.
This name adds only a little bit of confusion on wrong (historically)
Apache::Session namespace - there is a direct tie between Apache::Session
and mod_perl? ;-)

When I started with my little project I've first searched on CPAN and the 
most similar module I founded was the AxKit-XSP-Session. Unfortunately this 
is a session manager plugin for AxKit and my goal was to develope a module 
with no glue with other applications server that the mod_perl itself.
Then I've chosen Apache::SessionManager (I've discarded 
Apache::Session::Manager name, of course) but before putting the first line of 
code on CPAN, I have sended various RFCs to mod_perl and [EMAIL PROTECTED] 
mailing lists, to comp.lang.perl.misc and comp.lang.perl.modules: this is 
the standard way to contribute to CPAN.
See ml/news archives for the complete threads [...]

I have done a (very) quick look to your code and I've seen some likeness with 
Apache::AuthCookie and/or Apache-AxKit-Plugin-Session. 
If you were doing something like this, you could probably start with one of the 
Auth* modules, which already do a good job of handling things.
I am also working to add this features not to my module but adding 
session management in Apache::AuthCookie!
Moreover, I agree about a possibility of the integration with your additional 
features into my Apache::SessionManager.

Regards

- Enrico 




[PATCH] Apache::Session

2002-10-25 Thread Enrico Sorcinelli
Hi Jeffrey,
I've found a little bug in clean method of Apache::Session::Lock::File when
it checks lockfiles last access time.
In effects the result of the expression (file ./Session/Lock/File.pm, line 136)

(stat($dir.'/'.$file))[8] - $now

is always negative and lock dir cleanup isn't done.
The patch simply inverts the check (also I've attached it)

Bye,
Enrico

PS: Sorry for this re-post, but I've submitted this patch also a few months
ago with no response ;-)

-

--- File.pm Sat Sep  2 00:21:17 2000
+++ File.pm-patched Sat Mar 30 10:38:54 2002
 -133,7 +133,7 
 my files = readdir(DIR);
 foreach my $file (files) {
 if ($file =~ /^Apache-Session.*\.lock$/) {
-if ((stat($dir.'/'.$file))[8] - $now = $time) {
+if ($now - (stat($dir.'/'.$file))[8] = $time) {
 open(FH, +$dir/.$file) || next;
 flock(FH, LOCK_EX) || next;
 unlink($dir.'/'.$file) || next;





Apache-Session-1.54-patch
Description: Binary data


[ANNOUNCE] Apache::SessionManager 0.04

2002-10-25 Thread Enrico Sorcinelli
The uploaded file
 Apache-SessionManager-0.04.tar.gz 

has entered CPAN as

   file: $CPAN/authors/id/E/EN/ENRYS/Apache-SessionManager-0.04.tar.gz
   size: 11197 bytes
   md5: b6a6e234ddac1b9a4741ab0413aa3013

Changes from previous version
-
This is a maintenance release. It fixes some problems of test suite.
 
+ Set '/' as default path attribute for session cookies
! Updated Makefile.PL in order to skip generation of Apache test section
  in Makefile if 'use Apache::test' fails (noticed by Jeroen Latour
  [EMAIL PROTECTED]). 
! Updated t/01real.t in order to skip it if 'use Apache::test' fails. 
  I've chosen simply to skip test if eval use Apache::test fails in 
  Makefile.PL, even if I think that Apache::SessionManager hasn't a 
  sense unless mod_perl :-)

Description
---

This package contains an Apache mod_perl module to manage HTTP sessions.
Apache::SessionManager is a mod_perl module that helps 
session management of a web application. This module is a 
wrapper around Apache::Session persistence framework for session data.
It creates a session object and makes it available to all other handlers 
transparenlty by putting it in pnotes. 

See perldoc Apache::SessionManager for module documentation and use

Any comment/criticism are welcome

- Enrico




[ANNOUNCE] Apache::SessionManager 0.03

2002-10-11 Thread Enrico Sorcinelli

The uploaded file
 Apache-SessionManager-0.03.tar.gz 

has entered CPAN as

   file: $CPAN/authors/id/E/EN/ENRYS/Apache-SessionManager-0.03.tar.gz
   size: 11080 bytes
   md5: f55d94602beec986b02ddd36234894e9


Changes from previous version
-

+ Added 'SessionManagerCookieArgs' PerlSetVar directive in order to
  set cookie optional attributes (like 'path', 'domain', ...).
+ Added experimental support 'SessionManagerEnableModBackhand'
  PerlSetVar directive in order to support mod_backhand sticky
  user session load balancing. Someone asked me this feature, 
  so I've added it, :-)
! Updated Makefile.PL httpd.conf extra lines
! Updated docs (added pod for new directives)  

Description
---

This package contains an Apache mod_perl module to manage HTTP sessions.
Apache::SessionManager is a mod_perl module that helps 
session management of a web application. This module is a 
wrapper around Apache::Session persistence framework for session data.
It creates a session object and makes it available to all other handlers 
transparenlty by putting it in pnotes. 

See SessionManager.pm pod for module documentation and use

Any comment/criticism are welcome

- Enrico




Re: [OT] document management

2002-09-18 Thread Enrico Sorcinelli


 What I need to find is a system that would allow users to upload word
 and/or pdf and/or html files into a library system that would
 automatically extract keywords and then file the documents into a
 database.  The goal of all this is to avoid having users doing double
 work, e.g. creating word docs only to convert, etc., while having a
 system that is as user friendly as possible because most of these users
  aren't technically savy.


I think that Greenstone is the suite you want.
It's open source, cross-platfrom and, last but not least,
it works very well with doc/pdf/html documents.

http://www.greenstone.org

- Enrico





Re: [mp2.0] wrong crypt behavior

2002-09-06 Thread Enrico Sorcinelli

On Fri, 6 Sep 2002 08:23:33 +0200
Tomá¹ Procházka [EMAIL PROTECTED] wrote:

 Hello,
 I use own PerlAuthenHandler module to verify users' login and password from
 database.
 
 For comparsion of password user entered and password stored in database is
 crypt function used.
 
 Here is the code:
 my $real_pass = $d-[0][0];   # crypted password from database
 my $salt = substr $real_pass,0,2; # salt
 my $test_pass = crypt $sent_pw,$salt; # in $sent_pw is the password user entered
 if ($real_pass eq $test_pass) {
   $r-subprocess_env(REMOTE_USER = $user);
   return OK;
 } else {
   $r-note_basic_auth_failure;
   return AUTH_REQUIRED;
 }
 
 Problem:  Sometimes, although user entered correct password, is authentication
 rejected. I tried logging values of $real_pass and $test_pass and they
 differed. When I add line
 
 $r-log_reason(User $user tested (.$real_pass./.$test_pass.)...,);
 
 just before 'if' statement behavior is most of time correct.
 
 Can anybody help me? Thanks.
 
 Kacer

Hi,
It seems to be not a mod_perl related problem.
However, try with:

$test_pass = crypt $sent_pw,$real_pass;

Bye,
- Enrico




Re: Seg Fault with PHP and Perl together

2002-09-05 Thread Enrico Sorcinelli

On Wed, 04 Sep 2002 18:17:44 +0100
Jon Harris [EMAIL PROTECTED] wrote:

 Hi
 
 I inherited a very happy cobalt raq3 with 2 sites using embedded Perl 
 which work very well. There are about 20 sites on the box. I needed to 
 get PHP running on the same box, so I made the module, added it into the 
 httpd.conf and PHP was working fine - Except that it broke the perl sites.
 
 The http error log entry is:
 child pid 22610 exit signal Segmentation fault (11)
 
 - the client gets a 'page not found error'.
 
 All I have to do get perl working again is to comment out
 
 LoadModule php4_module /usr/lib/apache/libphp4.so
 (and)
 AddModule mod_php4.c
 
 and restart httpd, it works fine again, obviously minus the php
 
 Bearing in mind, I am on about page 3 of O'Reilly's Apache - The 
 definitive Guide does anyone know the simplist way I can get it 
 working? I don't need any sites to use both embperl and php together.
 
 This is a virtual site section in httpd.conf for one of the perl sites 
 (anonymised) there is also a big Perl chunk in the httpd.conf, not 
 sure if that is relevant here.
 
 *
 VirtualHost 0.0.0.0
 ServerName thedomain.com
 ServerAdmin root
 DocumentRoot /home/sites/site42/web
 ServerAlias thedomain.com
 PerlModule Apache::DBI
 PerlModule HTML::Embperl
 PerlSetEnv EMBPERL_OPTIONS 8208
 PerlSetEnv EMBPERL_ESCMODE 0
 RewriteEngine on
 RewriteCond %{HTTP_HOST}!^0.0.0.0(:80)?$
 RewriteCond %{HTTP_HOST}!^www.thedomain.com(:80)?$
 RewriteRule ^/(.*)  http://www.thedomain.com/$1 [L,R]
 RewriteOptions inherit
 #Files *.htm*
 #SetHandler perl-script
 #PerlHandler HTML::Embperl
 #Options ExecCGI
 #/Files
 AliasMatch ^/~([^/]+)(/(.*))? /home/sites/site42/users/$1/web/$3
 AliasMatch ^/users/([^/]+)(/(.*))? /home/sites/site42/users/$1/web/$3
 # AddHandler server-parsed .shtml
 # AddTypetext/html .shtml
 AddHandler cgi-wrapper .cgi
 AddHandler cgi-wrapper .pl
 /VirtualHost
 *
 
 It looks like perl and PHP are getting in each others way, should I try 
 and make a new apache? what order should I do things in? Should I look 
 for another job? :), I need to get it working quickly and with the 
 minimum disruption to the server. Every time I try and do things like 
 this on a RAQ something breaks something else, usually its the GUI and I 
 get about 50 phone calls.
 

If you must resolve urgently this problem, you can consider the possibility
to proxy all mod_perl requests to an Apache/mod_perl enabled on a different
port (also this save more memory).

- Enrico







Re: Apache::DBI new connects in error_log...

2002-09-04 Thread Enrico Sorcinelli

On Tue, 3 Sep 2002 10:36:30 -0700 (PDT)
Anthony E. [EMAIL PROTECTED] wrote:

 
 --- Enrico Sorcinelli [EMAIL PROTECTED]
 wrote:
  On Tue, 3 Sep 2002 09:05:45 -0700 (PDT)
  Anthony E. [EMAIL PROTECTED] wrote:
  
   Hello,
   
   I'm getting an awful lot of these error statements in
   my error_log file for apache:
   
   --
   25935 Apache::DBI new connect to
   'db:1.2.3.4UserPassAutoCommit=1PrintError=1'
   --
   
   It looks like they are happening for every database
   connection, like the db connections are not staying
   persistent. I'm using Apache::DBI in my startup.pl
   script under mod_perl. Also the web server has been
   crashing every 10 minutes, when the server load gets
   up to about 105.
   
   any ideas?
   
  
  There are some additional informations that you
  should supply
  in order to help you, like
  
  - Are connections per-user?
 How to i tell?

Hi Anthony,

Apache::DBI caches connection based on his args (dbd driver, user, password...)
and attributes. So, if your application uses a different user and/or 
attributes to connect to (a different?) database, every connection will be
cached. Also, every child could have these cached DB's handles.
Apache::DBI works very well for web applications that uses same DB user.

  - Have you loaded Apache::DBI before DBI or before
  any module that load it?
 Yes, in startup.pl.
 

This doesn't assure that you have loaded it before!
For instance if you have in your httpd.conf:

PerlModule DBI (or any module that uses it)
before
PerlRequire /path/to/startup.pl

or load DBI (or any module that uses it) before Apache::DBI
in your startup.pl script.

  - How many childs? (with Apache::DBI 1 child = 1
  connection)
 How to i tell?

On Unix/Linux you can do this:

   ps -A | grep -c httpd 
 

Bye
- Enrico


[OT]: The 2.11-13 paragraphs of mod_perl developers cookbook are a good 
  recipe! (if you are a mod_perl developer you must to have it! ;-)



[ANNOUNCE] Apache::SessionManager 0.02

2002-09-04 Thread Enrico Sorcinelli

A new version 0.02 of Apache::SessionManager is now available via CPAN

Download site for Apache::SessionManager

  http://www.cpan.org/authors/id/E/EN/ENRYS/Apache-SessionManager-0.02.tar.gz

Description
---

This package contains an Apache mod_perl module to manage HTTP sessions.
Apache::SessionManager is a mod_perl module that helps 
session management of a web application. This module is a 
wrapper around Apache::Session persistence framework for session data.
It creates a session object and makes it available to all other handlers 
transparenlty by putting it in pnotes. 

See SessionManager.pm pod for module documentation and use

Changes from previous version
-

+ Added control to bypass expiration time check in new sessions
+ Use of session in test handler t/lib/PrintEnv.pm
+ Added tested platforms in POD [BUGS] section
! Bug fix: corrected print on STDERR in _tieSession() (debug mode only)
! Corrected Makefile.PL httpd.conf's extra lines
! Updated POD (moved PerlTransHandler outside Location section in
  a configuration example!)

Any suggestion are welcome

- Enrico




Re: Apache::DBI new connects in error_log...

2002-09-03 Thread Enrico Sorcinelli

On Tue, 3 Sep 2002 09:05:45 -0700 (PDT)
Anthony E. [EMAIL PROTECTED] wrote:

 Hello,
 
 I'm getting an awful lot of these error statements in
 my error_log file for apache:
 
 --
 25935 Apache::DBI new connect to
 'db:1.2.3.4UserPassAutoCommit=1PrintError=1'
 --
 
 It looks like they are happening for every database
 connection, like the db connections are not staying
 persistent. I'm using Apache::DBI in my startup.pl
 script under mod_perl. Also the web server has been
 crashing every 10 minutes, when the server load gets
 up to about 105.
 
 any ideas?
 

There are some additional informations that you should supply
in order to help you, like

- Are connections per-user?
- Have you loaded Apache::DBI before DBI or before any module that load it?
- How many childs? (with Apache::DBI 1 child = 1 connection)
- Software version (Apache, Perl, mod_perl, DBI and Apache::DBI) of course

Bye

- Enrico





[ANNOUNCE] Apache::SessionManager 0.01

2002-08-27 Thread Enrico Sorcinelli

Hi all,

I'm glad to announce first public release of 'Apache::SessionManager' 
Apache module.

Apache::SessionManager - simple Apache/mod_perl extension to manage sessions 
over HTTP requests.

Apache::SessionManager is a mod_perl module that helps session
management of a web application. This simple module is a wrapper around
Apache::Session persistence framework for session data. It creates a
session object and makes it available to all other handlers transparently 
by putting it in pnotes.

The goal of Apache::SessionManager was to do a module with _no_ glue with 
others mod_perl based appserver than mod_perl itself and Apache::Session.
to use in flat mod_perl handlers. (Also, it can be used with the appserver, 
of course).

For module installation, configuration and directives see:

perldoc Apache::SessionManager

You can download it from CPAN:

$CPAN/authors/id/E/EN/ENRYS/Apache-SessionManager-0.01.tar.gz

or:

http://www.sorcinelli.it/Apache-SessionManager-0.01.tar.gz


Yours

- Enrico Sorcinelli




Re: Some consideration about my Apache::SessionManager RFC

2002-08-09 Thread Enrico Sorcinelli


 I'd mail the authors at their last known addresses saying that you
 propose steal^H^H^H^H take over the namespace.  If you get no reply in
 a couple of weeks I'd guess you're safe enough to use it.


Today I've mailed to the author.
Also I've asked an advice to [EMAIL PROTECTED]

 I like your module and I like the name.  I'll give it a try when I get
 a chance.  (But don't hold your breath:).  Would you like some help
 with the documentation?


Thanks.
The module is work in progress. The perldoc I've written is also
temporary. The same directives can change from day to another :-)
Any help, comment or criticism are welcome!

- Enrico

PS: currently I've added user inactivity session expiration policy and I'm
working to use Apache::Session::Flex in order to customize session data
storage






Re: [RFC] Apache::SessionManager

2002-08-02 Thread Enrico Sorcinelli

On Fri, 02 Aug 2002 23:56:18 +0900
Tatsuhiko Miyagawa [EMAIL PROTECTED] wrote:

 Apache::SessionManager has once been discussed here.
 AFAIK it's not on CPAN though ..
 http://mathforum.org/epigone/modperl/clarcloigol
 

Hi Tatsuhiko,
I'am in modperl list from beginnig of 2001.
The thread you've linked me is out of date (October 2000!).

Moreover in CPAN there is no module with the same name.
Simply I've not found it and I've chose this name!

Yes, there is a conflictual namespacing but the two modules make _two_
different things!

- Apache::SessionManager that I propose is a wrapper around the 
  Apache::Session persistence framework for session data.
  My module use pnotes()to pass arbitrarly data across handlers
  and has a expiration session mechanism.
  I make this for transparent session management while write my modules
  using Apache::Session.

- After some search I've found the other (I think) module on sourceforge but 
  last update is out of date (2000-10-29 16:00)!
  After some analisys I've seen that the other module hasn't support
  for persistence data and has own ID generation algorythm. There is no
  glue with Apache::Session.
  This store only session value into notes().

Bye

- Enrico



=
Enrico Sorcinelli - Gruppo E-Comm 
Italia On Line S.p.a.
Via Malagoli, 12 - 56124 Pisa
Tel. +39 050 944303
E-Mail: [EMAIL PROTECTED]




Re: [RFC] Apache::SessionManager

2002-08-02 Thread Enrico Sorcinelli

On Fri, 02 Aug 2002 11:33:15 -0400
Perrin Harkins [EMAIL PROTECTED] wrote:

 Enrico Sorcinelli wrote:
  Apache::SessionManager creates an object session (in Header parsing phase, 
  but not obligatorily) and make it available to all other handlers 
  transparently by putting in pnotes. Others handlers can retrieve session
  directly from pnotes or by calling the simple function 
  Apache::SessionManager::get_session($r)
 
 It would be better if you don't instantiate the session until someone 
 asks for it the first time.  
That will prevent unnecessary work.  Also, 
 when using Apache::Session with any locking module except NullLocker, 
 it's very important to have the session object exist for the shortest 
 possible time because it is locking out all other access to that session 
 while it exists.  (For this reason, it's also very important to make 
 sure that requests for images and other static objects don't instantiate 
 Apache::Session objects.)
 

With Apache::SessionManager you can use tree distinct mechanism to prevent
this:
1) By activating the module only certain Location or Directory block:

Location /with-session
PerlHeaderParserHandler Apache::SessionManager
PerlSetVar SessionTracking On
/Location

2) By setting 'SessionItemExclude' directive to bypass all request
   matching the regexp. For example with:
 
PerlSetVar SessionItemExclude \.m.*$

   all the request (URI) ending by .mpeg, .mpg or .mp3 will
   be declined (no session object are created)

3) By de-activating the module in Location or Directory block:

Location /with-no-session
PerlSetVar SessionTracking Off
/Location


 Some of the Apache::Auth* modules like Apache::AuthCookieURL are close, 
 but I don't know of any that do the actual glue with Apache::Session. 
 You might want to look at some of the existing modules and see if a 
 merge of some kind is possible.
 

This modules haven't glue with Apache::Session

The only way that I know to have a session framework is to use mod_perl 
application server like AxKit, HTML::Mason or Apache::ASP ...

I've written Apache::SessionManager to be used _also_ in a mod_perl handlers 
or in a CGI script over Registry.

Thanks for your interest

- Enrico





=
Enrico Sorcinelli - Gruppo E-Comm 
Italia On Line S.p.a.
Via Malagoli, 12 - 56124 Pisa
Tel. +39 050 944303
E-Mail: [EMAIL PROTECTED]




Re: [RFC] Apache::SessionManager

2002-08-02 Thread Enrico Sorcinelli

On Fri, 2 Aug 2002 16:31:04 +0100 (BST)
Matt Sergeant [EMAIL PROTECTED] wrote:

 There's the AxKit one, which does something pretty similar -
 AxKit::XSP::Session I think it's called.

It seems to be two modules that manage sessions over AxKit:

Apache::AxKit::Plugin::Session (flexible session management for AxKit)

and 

AxKit::XSP::Session

but both requires AxKit framework (and Apache::Session, of course)

The main reason for which I've written Apache::SessionManager is that 
only mod_perl is required (and Apache::Session, ;-))

I consider AxKit a powerful appserver (that I've used in the past)
but for some applications I only had need of simple mod_perl handlers

Thanks 

 - Enrico

=
Enrico Sorcinelli - Gruppo E-Comm 
Italia On Line S.p.a.
E-Mail: [EMAIL PROTECTED]




Re: [RFC] Apache::SessionManager

2002-08-02 Thread Enrico Sorcinelli

On Fri, 02 Aug 2002 13:12:30 -0400
Perrin Harkins [EMAIL PROTECTED] wrote:

 Right, that's my point.  Your module has overlap with them in terms of 
 managing cookies and specifying locations, but adds the actual calls to 
 Apache::Session.  If I were doing something like this, I would probably 
 start with one of the Auth modules, which already do a good job of 
 handling things like cookie verification and even cookie-less sessions, 
 and add the actual Apache::Session glue.

The merge code solution is a possible solution that I'll consider 

 It might at least be worth stealing some code from the other modules, 
 like the ticket-based cookies idea, but of course you can do what you 
 like.  I think it's good to have a module like this, and if you put 
 yours out there people can contribute to it. 

Thanks, I'll do it as soon as possible...

 Incidentally there is also 
 a session manager module very similar to this in the Extropia modules.

Sincerely, I don't know Extropia modules!

 
  I've written Apache::SessionManager to be used _also_ in a mod_perl handlers
  
  or in a CGI script over Registry.
 
 The Apache::Auth modules also support that.

The Apache::Auth* family support authentication with cookies but there aren't
methods to store persistent data over HTTP requests (other than session key)

Apache::SessionManager only manage sessions and actually you can write
a custom PerlAuthenHandler to autohorize user accesses to certain resources

Bye

- Enrico 




=
Enrico Sorcinelli - Gruppo E-Comm 
Italia On Line S.p.a.
E-Mail: [EMAIL PROTECTED]




[RFC] Apache::SessionManager

2002-08-02 Thread Enrico Sorcinelli
.

   PerlSetVar SessionExpire 600

The default value is `900' seconds

`SessionName' string
This single directive define session name

   PerlSetVar SessionName PSESSID

The default value is `PERLSESSIONID'

`SessionStore' file|db|ram|db_file
This single directive set the session datastore used by
Apache::Session framework

   PerlSetVar SessionStore file

* file
Store session in file system

* db
Not (yet) implemented

* ram
Not (yet) implemented

* db_file
Not (yet) implemented

The default values is `file'

`SessionDirectory' path
This single directive define the directory for the object store when
`SessionStore' is set to `file'.

   PerlSetVar SessionDirectory /tmp/apache_session

The default value is `/tmp'

`SessionLockDirectory' path
This single directive define the locking directory for the object
store.

   PerlSetVar SessionLockDirectory /tmp/apache_session/lock

The default value is `/tmp'

`SessionItemExclude' string|regex
This single directive define the exclusion string For example:

   PerlSetVar SessionItemExclude exclude_string

Alle the HTTP request containing the 'exclude_string' string will be
declined. Also is possible to use regex:

   PerlSetVar SessionItemExclude \.m.*$

and all the request (URI) ending by .mpeg, .mpg or .mp3 will
be declined.

The default value is

`(\.gif|\.jpg|\.jpeg|\.png|\.css|\.js|\.mpg|\.mpeg|\.txt|\.mp3|\.wa
v|\.swf|\.avi|\.au|\.ram|\.rm)$'

TODO
* Implement wrapper for RAM, DB and db_file session datastore 
* Include into the distro the session cleanup script (the scripts I use
for cleanup actually)
* Embed the cleanup policies not in a extern scripts but in a
register_cleanup method
* Consider user inactivity for session expiration policy
* Test, test ,test

AUTHORS
Enrico Sorcinelli [EMAIL PROTECTED]

BUGS
Send bug reports and comments to: [EMAIL PROTECTED] In each report
please include the version module, the Perl, Apache, and 
mod_perl version and your SO. If the problem is browser dependent please
include also browser name and version.

SEE ALSO
Apache::Session, Apache::Request, Apache, perl(1)

COPYRIGHT
Copyright (C) 2001,2002 Enrico Sorcinelli

--



Enrico Sorcinelli - E-mail: [EMAIL PROTECTED]
[EMAIL PROTECTED] - Gruppo E-Comm - Italia On Line S.p.a.




Some consideration about my Apache::SessionManager RFC

2002-08-02 Thread Enrico Sorcinelli

Hi all.
First of all, sorry for my duplicate RFC post to this list.

I've submitted today an RFC to mod_perl ml, as you've maybe seen.
The main problem is that another old RFC with the same namespace has been
submitted.
However the RFC is out of date (October 2000!!!) and the module hasn't been 
_never_
uploaded to CPAN.
Then I've search and I've found this module only on sourceforge but
the project seems to be closed (the last 'work in progress' version is
dated october 2000).
Moreover the two modules do two _different_ things.
How I proceed in this case?

Thanks in advance

- Enrico




Re: Terminating an HTTP process

2002-07-23 Thread Enrico Sorcinelli

On Tue, 23 Jul 2002 18:58:14 +1000
Mark Ridgway [EMAIL PROTECTED] wrote:

 Hi All,
 
 We're running Mason 1.04 (Apache/1.3.22 (Solaris) mod_perl/1.26
 mod_ssl/2.8.5 OpenSSL/0.9.6b) which connects to a number of Oracle
 databases, so we are using Apache::DBI for connection pooling.
 
 As we understand it, each process has its own connection pool that
 lasts for the life of that process (i.e. each child collects its own
 set of DB handles until it dies).
 
 Whilst this is normally not an issue, when we experience network
 problems, the number of available connections on some crucial databases
 can quickly run out, which many open connections sitting idle in the
 pool of various clients using other DBs, etc.
 
 What we'd like to do is send some kind of quit signal to the process
 so that it finishes that transaction and dies, instead of waiting until
 MaxRequestsPerChild.  This will ensure that DB handles for this
 particular DB will not be idly pooled, but instead constantly in use.
 
 Is there a command to do this? (e.g. like 'abort', but one that
 completes the transaction successfully, and kills the child process).
 (e.g. $r-die() :-)
 
 Also, does anyone know how to get the current RequestsPerChild
 counter (that MaxRequestsPerChild evaluates against)?
 

 


Hi Mark,
if you don't need persistent connections for all Oracle DBs
you can try to use some nonpersistent connections by setting
'dbi_connect_method' property to 'connect' in DBI connect
hash options:

  my $dbh = DBI-connect('dbi:...',... ,{'dbi_connect_method' = 'connect'});

However I think that the right solution is a connection pool server 
like SQLRealy (it work very well with Oracle, MySQL, PostgresSQL, DB2, etc)

Bye

Enrico

=
Enrico Sorcinelli - Gruppo E-Comm - Italia On Line S.p.a.
E-Mail: [EMAIL PROTECTED] - [EMAIL PROTECTED]
=



Re: two distinct installations

2002-04-23 Thread Enrico Sorcinelli

On Tue, 23 Apr 2002 12:28:24 +0200 (MEST)
Carlo Giomini [EMAIL PROTECTED] wrote:

 Hi there!
 I wonder if it is possible to have two distinct installations of mod_perl
 on the same machine, let's say one made as root user and another as
 normal user.
 Thanks for helping,
   Carlo. 
 
 
 

You can running two apache (using the same DSO binary installation) with 
two different httpd.conf file specifying User and Group (and Port, off course)
directives that you need.
By the way, be careful if you run apache as root user

Bye
- Enrico




=
Enrico Sorcinelli - Gruppo E-Comm 
Italia On Line S.p.a.
Via Malagoli, 12 - 56124 Pisa
Tel. +39 050 944303
E-Mail: [EMAIL PROTECTED]




[PATCH] Apache::Session::Lock::File (Apache::Session 1.54)

2002-03-29 Thread Enrico Sorcinelli

Hi Jeffrey,
I've found a bug in clean method of Apache::Session::Lock::File when check 
lockfiles last access time.
In effects the result of expression:

(stat($dir.'/'.$file))[8] - $now

is always negative and lock dir cleanup isn't done.
The patch simply inverts the check.

Bye,
Enrico


--- File.pm Sat Mar 30 01:54:18 2002
+++ File.pm-patched Sat Mar 30 01:53:59 2002
@@ -133,7 +133,7 @@
  my @files = readdir(DIR);
  foreach my $file (@files) {
  if ($file =~ /^Apache-Session.*\.lock$/) {
-if ((stat($dir.'/'.$file))[8] - $now = $time) {
+if ($now - (stat($dir.'/'.$file))[8] = $time) {
  open(FH, +$dir/.$file) || next;
  flock(FH, LOCK_EX) || next;
  unlink($dir.'/'.$file) || next;


=
 Enrico Sorcinelli - Gruppo E-Comm - Italia OnLine S.p.a. - www.iol.it
 E-Mail: [EMAIL PROTECTED] - [EMAIL PROTECTED]
= 




Re: Cookies and redirects

2002-03-13 Thread Enrico Sorcinelli

On Tue, 12 Mar 2002 16:23:57 +0100
Axel Andersson [EMAIL PROTECTED] wrote:

 Hello,
 I'm having trouble with both setting a cookie and redirecting the user to
 another page at the same time. It would appear the cookie is only sent
 when a normal header is sent by server.
 
 If I do the following (having baked the cookie first), where $r is the
 Apache-request() object:
 
   $r-content_type(text/html; charset=iso-8859-1);
   $r-send_http_header();
 

Hi,
a common trick to solve this is to use err_header_out() request method. For example:

use Apache::Constants qw(:common);
$r-err_header_out(Set-Cookie = $my_cookie );
$r-custom_response(SERVER_ERROR, $my_custom_redir_location);
return SERVER_ERROR;

Bye
Enrico

=
Enrico Sorcinelli - Gruppo E-Comm - Italia On Line S.p.a.
E-Mail: [EMAIL PROTECTED] - [EMAIL PROTECTED]
=



Apache::Status override keys in menu_item() sub

2002-03-08 Thread Enrico Sorcinelli

Hi all,
I've seen that there is a conflict situation in Apache::Status module 
(v 2.02, mod_perl 1.26) in handling plug-in items.
In effect when I install an Apache::Status menu item plug-in, there isn't 
control over pre-installed items.
For example I can add following item in my module:

# prepare menu item for Apache::Status
Apache::Status-menu_item(
   'inc' = 'Overriding Apache::Status menu item',
   sub {
  my($r, $q) = @_;
  my(@s) = HRMy dump.../HR;
  return \@s;
   }
) if ( $INC{'Apache.pm'}  Apache-module('Apache::Status') );  

In this way, I will override the %status hash entry corresponding to 
'Loaded Modules'.
Any chances to patch this by checking existent items before typeglobbing?

This is a _very simple_ proposal patch:

---CUT HERE---
--- Status.pm   Fri Mar  8 13:11:05 2002
+++ Status.pm-patched   Fri Mar  8 13:10:55 2002
@@ -45,6 +45,12 @@
 
 sub menu_item {
 my($self, $key, $val, $sub) = @_;
+
+if ( defined $status{$key} ) {
+print STDERR Apache::Status:key '$key' already defined! Plug-in 
+installation skipped\n;
+return;
+}
+
 $status{$key} = $val;
 no strict;
 *{status_${key}} = $sub 
---CUT HERE---

Bye,

Enrico


=
Enrico Sorcinelli - Gruppo E-Comm - Italia On Line S.p.a.
E-Mail: [EMAIL PROTECTED] - [EMAIL PROTECTED]
=



Re: Apache::DB patch

2002-03-05 Thread Enrico Sorcinelli

On Tue, 05 Mar 2002 10:00:56 +0800
Stas Bekman [EMAIL PROTECTED] wrote:

 Enrico Sorcinelli wrote:
  On Fri, 01 Mar 2002 11:16:15 +0800
  Stas Bekman [EMAIL PROTECTED] wrote:
  
  
 Enrico Sorcinelli wrote:
 
 Hi all,
 I started to use Apache::DB (0.06) to interactively debug under mod_perl using 
ptkdb. I see that is necessary to modify Apache/DB.pm but, after this, the debugger 
will be run always under ptkdb. The little patch I propose to Apache/DB.pm is to 
improve Apache to dinamically switch from command line to GUI (ptkdb) interface by 
configuring this in httpd.conf.
 
 Hi Enrico,
 
 Does it actually work for you? My previous experience with it wasn't so 
 good. I was manually loading Devel/ptkdb.pm instead of Apache/perl5db.pl
 and it'll work for the first request, but then will hang. I see that 
 ptkdb hasn't changed since the last time I've tried it. May be it's a 
 newer perlTk that works better now?
 
 
  
  Dear Stas,
  I know the hang problem (I've started to hack the ptkdb code but it is enough 
complex...)
  However I find the GUI debugger useful. My TEMPORARY workaround is:
  
  1) Initially (and if possible) I've used a brutal 'kill 9 $$' code in cleanup 
handler
  
  if (ref $r) {
  $SIG{INT} = \DB::catch;
  $r-register_cleanup(sub { 
  $SIG{INT} = \DB::ApacheSIGINT();
  
   kill 9, $$ if $ptkdb;
 
  });
  }
 
 Yup, tried that, but I didn't like that approach.

I agree with you, was only a drastic and immediate solution!

 
  then now
  
  2) I use the ptkdb 'File' menu command Close Window and Run (but I've added this 
in the button bar) instead of Run. In this case at the end of code, the debugger 
won't hang and the window will closed. Note that if there are breakpoint, the window 
will be closed and re-opened and all breakpoint are maintained (it is more convenient 
to use 'Close Window and Run' only after last breakpoint).
 
 Cool! Any chance you can submit a patch to the author of ptkdb so we can 
 all benefit from this trick? CC'ing mod_perl list will be useful too.

I've attached the patch to this e-mail. Also I will submit to the author asap.
Note: the patch only add a short cut for Close Window and Run as Run and Exit in 
main button bar (type 'patch -p0  Devel-ptkdb-1.1074-patch' in the same dir of 
Devel/ptkdb.pm)

 
 I wish someone with perl/Tk knowledge could solve the hanging problem.
 

I wish me too!
After a brief ptkdb.pm code analysis, I've seen that the debugger seems to hang, after 
last 'Run' command, in Tk::DoOneEvent(0) call (main_loop sub, line 2922).

Yours

Enrico


=
Enrico Sorcinelli - Gruppo E-Comm - Italia On Line S.p.a.
E-Mail: [EMAIL PROTECTED] - [EMAIL PROTECTED]
=





Devel-ptkdb-1.1074-patch
Description: Binary data


Re: Apache::DB patch

2002-03-04 Thread Enrico Sorcinelli

On Fri, 01 Mar 2002 11:16:15 +0800
Stas Bekman [EMAIL PROTECTED] wrote:

 Enrico Sorcinelli wrote:
  Hi all,
  I started to use Apache::DB (0.06) to interactively debug under mod_perl using 
ptkdb. I see that is necessary to modify Apache/DB.pm but, after this, the debugger 
will be run always under ptkdb. The little patch I propose to Apache/DB.pm is to 
improve Apache to dinamically switch from command line to GUI (ptkdb) interface by 
configuring this in httpd.conf.
 
 Hi Enrico,
 
 Does it actually work for you? My previous experience with it wasn't so 
 good. I was manually loading Devel/ptkdb.pm instead of Apache/perl5db.pl
 and it'll work for the first request, but then will hang. I see that 
 ptkdb hasn't changed since the last time I've tried it. May be it's a 
 newer perlTk that works better now?
 

Dear Stas,
I know the hang problem (I've started to hack the ptkdb code but it is enough 
complex...)
However I find the GUI debugger useful. My TEMPORARY workaround is:

1) Initially (and if possible) I've used a brutal 'kill 9 $$' code in cleanup handler

if (ref $r) {
$SIG{INT} = \DB::catch;
$r-register_cleanup(sub { 
$SIG{INT} = \DB::ApacheSIGINT();
 kill 9, $$ if $ptkdb;
});
}

then now

2) I use the ptkdb 'File' menu command Close Window and Run (but I've added this in 
the button bar) instead of Run. In this case at the end of code, the debugger won't 
hang and the window will closed. Note that if there are breakpoint, the window will be 
closed and re-opened and all breakpoint are maintained (it is more convenient to use 
'Close Window and Run' only after last breakpoint).

Enrico


=
Enrico Sorcinelli - Gruppo E-Comm - Italia On Line S.p.a.
E-Mail: [EMAIL PROTECTED] - [EMAIL PROTECTED]
=



Apache::DB patch

2002-02-28 Thread Enrico Sorcinelli

Hi all,
I started to use Apache::DB (0.06) to interactively debug under mod_perl using ptkdb. 
I see that is necessary to modify Apache/DB.pm but, after this, the debugger will be 
run always under ptkdb. The little patch I propose to Apache/DB.pm is to improve 
Apache to dinamically switch from command line to GUI (ptkdb) interface by configuring 
this in httpd.conf.
To enable ptkdb I add the directive:
 
PerlSetVar PerlTkDB On
 
in preferred place of my httpd.conf. For example:

Location /someplace
   IfDefine PERLDB
  PerlSetVar PerlTkDB On
  PerlFixupHandler Apache::DB
   /IfDefine
   SetHandler perl-script
   PerlHandler Apache::MyModule
/Location

then start Apache with:

% httpd -D PERLDB

If Devel::ptkdb isn't installed, then default debug libraries (perl5db.pl) are loaded.

---CUT HERE---
--- DB.pm   Thu Feb 28 16:45:29 2002
+++ DB.pm-patched   Thu Feb 28 16:31:12 2002
@@ -26,7 +26,9 @@
 
 init();
 
-require 'Apache/perl5db.pl';
+unless ( $r-dir_config('PerlTkDB')  eval(require 'Devel/ptkdb.pm') ) {
+require 'Apache/perl5db.pl';
+}
 $DB::single = 1;
 
 if (ref $r) {
---CUT HERE---
 
(run the patch in the same directory of Apache/DB.pm)

Any comment will be appreciated.

Enrico

=
Enrico Sorcinelli - Gruppo E-Comm - Italia On Line S.p.a.
E-Mail: [EMAIL PROTECTED] - [EMAIL PROTECTED]
=