Re: Mount something with my perl script

2002-07-24 Thread Michael Jacob

Hi,

ouch, bad idea, wrong list, but:

4 solutions:

1.) let your webserver run as root (NEVER, NEVER 
do this!!)

2.) write a daemon that runs as root and does such 
things for your normal programs. (Overkill in this 
case)

3.) use sudo to allow the webserver's user to run 
exactly that command (with exactly that 
parameters)

4.) put that mount into your /etc/fstab with 
parameters noauto, user (noauto = don't mount at 
system boot time, user = allow any user to mount)

cu
Michael

24.07.2002 13:55:13, Heiss, Christian 
[EMAIL PROTECTED] wrote:



  From:   Heiss, Christian 
[EMAIL PROTECTED]

  To: '[EMAIL PROTECTED]' 
[EMAIL PROTECTED]
  Subject:Mount something with my perl script
  Date:   Wed, 24 Jul 2002 13:55:13 +0200




  Hello,


  I don't know if this is the right mailing list, 
but well...


  How can I mount something with my perl script?
  I've got always the error: mount: only root can 
do this


  So I changed my script something like this:


  #! /usr/bin/perl -w
  `su - root password -c 'mount -t smbfs -o  
credentials=some.file //
  windows/share /mount/point'`;


  If I start the script in the shell as root, it 
works fine.


  If I start the script in the shell as some 
other user, it asked me for the
  password.


  If I start the script in via the Internet-
Browser, in the log files it first
  asked for the password and after one second it 
completes to incorrect
  password


  How can I change my script to execute the mount 
command as root
  automatically, or to mount something within my 
perl script???




  Thanks





  Regards




  Christian Heiss


  ___
__

  LANconcept Moll GmbH

  Benzstrasse 1
  88074 Meckenbeuren
   
  Voice:  +49 (0) 7542 940 3 - 18

  Fax:+49 (0) 7542 218 24
  Mobil:  +49 (0) 171  80 64 254
  mailto:[EMAIL PROTECTED]
  visit our website http://www.datentechnik-
moll.de

  ___
__






Apache::PerlRun und Prototypes

2001-11-14 Thread Michael . Jacob

Hi,

I just found that one of our Perl scripts used CORE::exit, I changed that
and found a whole bunch of problems. The biggest one is, that
Apache::PerlRun doesn't seem to like prototypes. It runs the script some
times but will eventually fail with

[Wed Nov 14 17:05:00 2001] [error] PerlRun: `[Wed Nov 14 17:05:00 2001] Subs.pl: [Wed 
Nov 14 17:05:00 2001] Subs.pl: Not a CODE reference at
/opt/y/cgi-bin/Sources/MJTools.pl line 110.
[Wed Nov 14 17:05:00 2001] Subs.pl: Compilation failed in require.
'

MJTools.pl:110 is fclose(F);
Subs.pl is sub fclose ($) {

I removed all prototypes and this problem was gone. Oh, BTW: The mentioned files and 
line number doesn't always relate to the problem.

Another point was this construct:

use subs 'exit';
sub exit {
[...]
   CORE::exit( $_[0] || 0 );
}

eval {
main; # uses exit() at about 100 places
};
if ($@) {
fatal_error(Untrapped Error:BR $@);
}

I'm still not sure how to change that The Right Way to work with mod_perl, but the 
following works. Maxbe someone has a better idea?

use subs 'exit';
sub exit {
[...]
Apache::exit(0); # 0=OK, -2=DONE
}

eval {
main;
};
if ($@ =~ /^\S+at /s) {
fatal_error(Untrapped Error:BR $@);
}
Apache::exit(0);

Yes, both Apache::exits are needed. If I leave the first one a CORE::exit, the child 
really exits, if I leave out the second, it would 500...

Michael





Antwort: http or https in URL?

2001-11-06 Thread Michael . Jacob


Hi,

we're using the following code:

sub savelink ($modul: string min 4 max 4, $page: string default index.html) {
  my $r = Apache-request;
  my $session_id = $r-pnotes('sessionid');

  my $uri = Apache::URI-parse($r);
  my $hostinfo = $uri-hostinfo;
  my $scheme =  $uri-scheme;

  my $url = $scheme . '://' .
$hostinfo . '/'.
$session_id . '/' .
$GAD::SessionMgr::DIR_PREFIX . '/' .
$modul . '/' .
$page;

  return $url;
}

You may want to use
  (undef, $rest) = split '/', $r-uri, 2;
  $rest .= '?' . $r-args if $r-args;
instead of $modul and $page.

Michael


Datum: 06.11.2001 16:43
An:[EMAIL PROTECTED]


Betreff:   http or https in URL?
Nachrichtentext:

In a mod_perl handler I want to construct the original URL of the request.
I
can construct it with r-get_server_name, r-get_server_port, r-uri and
$r-parsed_uri-query.

But how do I get the protocol, http or https.  Is there a way to find out
whether SSLEngine On is set?

Yes, I can set it with PerlSetVar protocol https, but is there a simpler
way?

Thanks in advance,
Peter
--
/\ ASCII Ribbon Campaign
\ /
 X Against HTML
/ \ in e-mail  news








Antwort: [OT] Inspired by closing comments from the UBB thread.

2001-08-06 Thread Michael . Jacob

Hi,

our code contains exactly one SQL-Statement:

our $getSQL = 'select SQLSTMT, INPARAM, OUTPARAM from SQLSTMT where ID=?';

but I think it would even be cleaner to use a PerlSetVar for that...

cu
Michael


Datum: 01.08.2001 17:14
An:[EMAIL PROTECTED]


Betreff:   [OT] Inspired by closing comments from the UBB thread.
Nachrichtentext:


All,

In his closing comments about UBB Kyle Dawkins made a statement that got me
wondering. He said there's SQL embedded all throughout the Perl everywhere
(who does this?! oh my god, are they on crack?). This comment got me
wondering about alternatives to embedding SQL in to the code of a program.
Alternatives I see are to use stored procedures which would limit one to
using a certain DB server (or to be proficient in many servers and write
stored procedures for all server flavors which would mean one is a very busy
Perl and SQL guru) or possibly storing the embedded SQL in some sort of
external file structure accessible via storable, XML::Simple or some other
means.

It would be interesting to know how other people have solved that problem.
Currently, we are essentially using embedded SQL in our apps.

Thanks in advance.

--Joe Breeden

--









Sorry for the Out Of Office-Notification(s)!

2001-07-02 Thread Michael . Jacob

Hi all,

I just found out that our mail system doesn't honor the don't send to the
internet-switch in the Out-Of-Office-Profile. :-((

Sorry for all that German Out-Of-Office mails that you all got...

Michael





Antwort: Re: Appending Sessionid to all the urls

2001-05-23 Thread Michael . Jacob

Hi kheeteck,

as said before - a session id at the end of the URL (as path info, GET parameter
or POST parameter) will not stay there if you don't modify all displayed html
pages. As I understand, you can't modify these pages because thay are on another
server. That means you also can't use a leading session id. Bad. There is only
one way left to store information on the browser's side: Cookies.

cu
Michael


Datum: 22.05.2001 19:10
An:Michael Jacob/EXT/GAD@GAD
Kopie: [EMAIL PROTECTED]

Betreff:   Re: Appending Sessionid to all the urls
Nachrichtentext:


Hi Michael :

I am really glad that you reply to my mail.. as i have been trying to solve
this problem for quite some time
Hmm , however i think u slightly misunderstand what i mean..

What i mean is...
For eg,

I have a html page which contains a form page let say allowing the user to
enter certain values... like colorNo etc.
This values would be posted to my server and the data would be stored in a
database(mysql) together with a unqiue
session id which would be generated. ( for this part i have finished and is
working).

Now comes the problematic part, after the values are submitted. I  want this
value to be avaiable to me each time
as user enter a new url from the browser( take note this url is not the
content residing in my server.. it is any remote site url).
The only way is to append a session id at the url.

So for instance.. after the user finished entering the form page. He can now
access any urls(remote site). How do i tell the server that this is the user
who has entered the form earlier based on the session id generated. And for
all the subsquent links... how can i append the session id.

I would greatly appreciated if you could help me out..
Really thanks to you

Regards
kheeteck






- Original Message -
From: [EMAIL PROTECTED]
To: ktgoh [EMAIL PROTECTED]
Cc: mod_perl [EMAIL PROTECTED]
Sent: Wednesday, May 23, 2001 12:27 AM
Subject: Re: Appending Sessionid to all the urls


 Hi ktgoh,

 you don't tell the browser about the session id. Why?

 To use a session id that's appended to the URL is hard work - it has to be
 maintaned in every module and html file. So you must append the session id
to
 every URL in every page and every piece of code that produces html. Ther
is no
 way to automatically keep the id sticky.

 A better way for session ids is to put them in front of the URI:
 http://www.nus.edu.sg/dfd3453/some/path/and/file.html

 This is (part of) my uri-translation-handler:

 sub handler ($r: Apache) {
   # only do initial request - not an internal sub req
   return DECLINED unless $r-is_initial_req;
   return DECLINED unless $r-uri =~ m/$DIR_MATCH/o;

   try my $check_uri = check_uri($r);
   return DECLINED if $check_uri; # URI contains session id and session
object
 could be read from the DB

   # else redirect to mangled URI
   try my $session_id = make_session_id($r);
   redirect($r, $session_id);
   return REDIRECT;
   # end of main handler
 }

 sub check_uri ($r: Apache) {
   my $uri = $r-uri || undef;
   my (undef, $sessionid, $rest) = split '/', $uri, 3;
   if ($sessionid  $sessionid =~ m/^[0-9a-h]{32,32}$/o) {
 $r-uri(/$rest);
 try void lock_session_id($r, $sessionid);
 return 1;
   }
   return undef;
 }

 sub redirect ($r: Apache, $session_id: string min 32 max 32) {
   my $args = $r-args ? '?' . $r-args : '';
   my $uri = $r-parsed_uri;
   $redirect = $uri-scheme . '://' . $uri-$hostinfo . '/'. $session_id .
'/' .
 $uri-path . $args;
   $r-header_out(Location = $redirect);
 }

 These session ids are sticky as long as you only use relative paths in
your
 html. Note: You may want to put your images in a directory that's not
covered by
 this handler and use absolute paths...


 Datum: 22.05.2001 12:03
 An:mod_perl [EMAIL PROTECTED]


 Betreff:   Appending Sessionid to all the urls
 Nachrichtentext:


 Hi all :

 I wanted to write a mod URL rewrite program.

 I wanted to append session ID to the tail of all the urls of a website.

 For instance when i access url http://www.nus.edu.sg?sessionid=dfd3453
 i want all the urls to be appended in all the urls of that website..

 My qns is everytime i found that the session id is lost... through the
many
 requests and responses.
 And the new url does not reflect on the client browser..

 Any one got any idea.. what wrong with my program??

 Thanks for your help...

 sub handler {

  my $r = shift;
  my $url = $r-uri;
  my $sessID;

  if($url =~ m/sessionid/){
   $sessID= getSessionID($url);
  }

  my $append =?sessionid=$sessID
  my $newURL = $r-uri($url$append);

  return DECLINED;

 }

 sub getSessionID{
  my  $url = $_[0];
  my  $position = rindex($url,=)+1;
  my  $sessID = substr($url,$position,8);
  return $sessID;
  }


 Regards
 kheeteck



















Re: Appending Sessionid to all the urls

2001-05-22 Thread Michael . Jacob

Hi ktgoh,

you don't tell the browser about the session id. Why?

To use a session id that's appended to the URL is hard work - it has to be
maintaned in every module and html file. So you must append the session id to
every URL in every page and every piece of code that produces html. Ther is no
way to automatically keep the id sticky.

A better way for session ids is to put them in front of the URI:
http://www.nus.edu.sg/dfd3453/some/path/and/file.html

This is (part of) my uri-translation-handler:

sub handler ($r: Apache) {
  # only do initial request - not an internal sub req
  return DECLINED unless $r-is_initial_req;
  return DECLINED unless $r-uri =~ m/$DIR_MATCH/o;

  try my $check_uri = check_uri($r);
  return DECLINED if $check_uri; # URI contains session id and session object
could be read from the DB

  # else redirect to mangled URI
  try my $session_id = make_session_id($r);
  redirect($r, $session_id);
  return REDIRECT;
  # end of main handler
}

sub check_uri ($r: Apache) {
  my $uri = $r-uri || undef;
  my (undef, $sessionid, $rest) = split '/', $uri, 3;
  if ($sessionid  $sessionid =~ m/^[0-9a-h]{32,32}$/o) {
$r-uri(/$rest);
try void lock_session_id($r, $sessionid);
return 1;
  }
  return undef;
}

sub redirect ($r: Apache, $session_id: string min 32 max 32) {
  my $args = $r-args ? '?' . $r-args : '';
  my $uri = $r-parsed_uri;
  $redirect = $uri-scheme . '://' . $uri-$hostinfo . '/'. $session_id . '/' .
$uri-path . $args;
  $r-header_out(Location = $redirect);
}

These session ids are sticky as long as you only use relative paths in your
html. Note: You may want to put your images in a directory that's not covered by
this handler and use absolute paths...


Datum: 22.05.2001 12:03
An:mod_perl [EMAIL PROTECTED]


Betreff:   Appending Sessionid to all the urls
Nachrichtentext:


Hi all :

I wanted to write a mod URL rewrite program.

I wanted to append session ID to the tail of all the urls of a website.

For instance when i access url http://www.nus.edu.sg?sessionid=dfd3453
i want all the urls to be appended in all the urls of that website..

My qns is everytime i found that the session id is lost... through the many
requests and responses.
And the new url does not reflect on the client browser..

Any one got any idea.. what wrong with my program??

Thanks for your help...

sub handler {

 my $r = shift;
 my $url = $r-uri;
 my $sessID;

 if($url =~ m/sessionid/){
  $sessID= getSessionID($url);
 }

 my $append =?sessionid=$sessID
 my $newURL = $r-uri($url$append);

 return DECLINED;

}

sub getSessionID{
 my  $url = $_[0];
 my  $position = rindex($url,=)+1;
 my  $sessID = substr($url,$position,8);
 return $sessID;
 }


Regards
kheeteck










Antwort: Appending Session ID behind URL

2001-05-18 Thread Michael . Jacob

Hi,

2 ways:

 * before sending the output do a =~
s#(http://[^/]+/)([^\s]*)#$1/$sessionid$2#i

 * or the cleaner way: don't use absolute URLs for your links. (but use them for
all images)

cu
Michael

PS: I hope you put the session id before the path part of the URL? It's much
easier to maintain...


Datum: 18.05.2001 05:33
An:mod_perl [EMAIL PROTECTED]


Betreff:   Appending Session ID behind URL
Nachrichtentext:


Hi all:
I have a textbox in the HTML page which allows users to enter url.
After the user click submit, i append the sessionid at the tail of the url.

My qn is.
how do i append all the links for that page with the sessionid.

In my Apache module

sub handler{

 $r = shift;
 $query = $r-uri;
}

i notice the first time i manage to get the sessionid from the $query, after
that the value is lost due to the many request that comes in.
How do i append the session ID to all the url before the response is sent out to
the client.



Thanks
All help appreciated
Firestar






Hi all:
I have a textbox in the HTML page which allows 
users to enter url.
After the user click submit, i append the sessionid 
at the tail of the url.

My qn is.
how do i append all the links for that page with 
the sessionid.

In my Apache module

sub handler{

 $r = shift;
 $query = 
$r-uri;
}

i notice the first time i manage to get the 
sessionid from the $query, after that the value is lost due to the many request 
that comes in.
How do i append thesession ID to all the url 
before the response is sent out to the client.



Thanks
All helpappreciated
Firestar




Strange error log entries

2001-05-18 Thread Michael . Jacob

[Perl 5.6.1, mod_perl 1.25, Apache 1.3.19 compiled with gcc 2.95.2 on Aix 4.3.3]

Hi all,

I've found some strange entries in the error_log and just don't know where to
start debugging. Could anyone point me into the right direction?


This is what I get when I try to Data::Dumper::Dumper any hash or object that
contains a DBI handle:

SV = RV(0x20c40bf4) at 0x206832b4
  REFCNT = 1
  FLAGS = (ROK)
  RV = 0x206832a8
[Fri May 25 10:19:07 2001] [error] dbih_getcom handle 'DBI::db=HASH(0x206832a8)'
 is not a DBI handle (has no magic) at /opt/perl/lib/5.6.1/aix/Data/Dumper.pm
line 150.


This is what I get after every request (after the cleanup-handler) (number
varies):

SV = RV(0x20c40bf4) at 0x206832b4
  REFCNT = 1
  FLAGS = (ROK)
  RV = 0x206832a8
SV = RV(0x20b172f4) at 0x2ff21f30
  REFCNT = 1
  FLAGS = (ROK,READONLY)
  RV = 0x206832a8
SV = RV(0x20c40b34) at 0x20cca2c4
  REFCNT = 1
  FLAGS = (ROK)
  RV = 0x20cca2d0
SV = RV(0x20ccd6f8) at 0x2ff21b38
  REFCNT = 1
  FLAGS = (ROK,READONLY)
  RV = 0x20cca2d0


An this on server restart (number varies):

Attempt to free unreferenced scalar.
Attempt to free unreferenced scalar.
Attempt to free unreferenced scalar.
Attempt to free unreferenced scalar.
Attempt to free unreferenced scalar.
Attempt to free unreferenced scalar.


TIA!

Michael Jacob





Startup behavier of Filter::Util::Call and DBI

2001-05-08 Thread Michael . Jacob

Hi all,

I just updated our development system to some recent versions...

Perl 5.6.0-5.6.1, Apache 1.3.14-1.3.19, mod_perl 1.24_1-1.25, DBI 1.14-1.15,
Filter 1.19-1.23 (+16 others).

Now this is what I get at server startup:

# /opt/apache/bin/apachectl start
startup.pl: starting (0)
/opt/apache/bin/apachectl start: httpd started
startup.pl: starting (1)
Subroutine Filter::tee::import redefined at
/opt/perl/lib/site_perl/5.6.1/aix/Filter/tee.pm line 11.
Subroutine filter_read_exact redefined at
/opt/perl/lib/site_perl/5.6.1/aix/Filter/Util/Call.pm line 24.
Subroutine filter_add redefined at
/opt/perl/lib/site_perl/5.6.1/aix/Filter/Util/Call.pm line 44.
Subroutine Filter::Util::Call::filter_read redefined at
/opt/perl/lib/site_perl/5.6.1/aix/Filter/Util/Call.pm line 59.
Subroutine Filter::Util::Call::real_import redefined at
/opt/perl/lib/site_perl/5.6.1/aix/Filter/Util/Call.pm line 59.
Subroutine Filter::Util::Call::filter_del redefined at
/opt/perl/lib/site_perl/5.6.1/aix/Filter/Util/Call.pm line 59.
Subroutine Filter::Util::Call::unimport redefined at
/opt/perl/lib/site_perl/5.6.1/aix/Filter/Util/Call.pm line 59.
startup.pl: starting (2)
DBI handle cleared whilst still active at
/opt/perl/lib/site_perl/5.6.1/aix/DBI.pm line 207.
dbih_clearcom (h 0x20189a90, com 0x2066cac8):
   FLAGS 0x211: COMSET Warn ShowErrorStatement AutoCommit
   TYPE 1
   PARENT undef
   KIDS 0 (0 active)
   IMP_DATA undef in 'DBD::DB2::dr'
[Tue May  8 11:59:41 2001] [notice] Apache/1.3.19 (Unix) mod_perl/1.25
mod_ssl/2.8.3 OpenSSL/0.9.6 configured -- resuming normal operations

Note: We don't use Apache::DBI, for the childs we do connection caching
ourselves and in the parent (startup.pl) we bootstrap a lot of ressources from
the DB to RAM (and disconnect!).

Now I've got 4 questions:

1.) What can I do about the Subroutine Filter... redefined messages in the 2nd
startup cycle and on further restarts. (They are new with the upgrade.)

2.) What can I do about the DBI handle cleared message in the 3rd startup
cycle. (This is not related to the upgrade.)

3.) Why is startup.pl executed THREE times? I thought it would be executed only
twice (with PerlFreshRestart ON)?

4.) Why do the redefineds come up in the 2nd startup and on further restarts and
the DBI in the 3rd only?

Thankscu
Michael Jacob





Antwort: Repost: Anyone using virtual server for mod_perl hosts?

2001-02-12 Thread Michael . Jacob

Hi,

I'm using a similar service at services.superb.net since last Friday (thanx
Martin :-), USD79/month, Linux.

They already had a Apache 1.3.9 with mod_perl 1.21 and Perl 5.005_03 +
mod_frontpage + mod_php + mod_ssl. That all seemed to work, but I quickly
uninstalled it and compiled my own perl/mod_perl/apache - Apache Toolbox is
great... :-)

I'm happy with this virtual box and had no problems.

Michael, http://j-e-b.net


Datum: 30.01.2001 19:49
An:"[EMAIL PROTECTED]" [EMAIL PROTECTED]


Betreff:   Repost: Anyone using "virtual server" for mod_perl hosts?
Nachrichtentext:



As many people understood I mean some kind of virtual host service, I
would like to restate my question.

There are companies (Verio at least) offering a 'virtual machine'
running a virtualized OS. Verio is offering NetBSD and Solaris. They
have a seriouly large iron where many virtual machines run, each virtual
machine gets a share of CPU, HD and RAM resources, an at least an IP
address.

In there is a full OS, and you get to be root for about $150 a month.
It's a cheap alternative to co-location, a middle ground between a good
virtual hosting service and owning a box. You can run your own MTA,
compile whatever the hell you want, etc, although they offer a bunch of
services out-of-the-box and have a lot of useful --if annoying-- cron
jobs rotating your logs, monitoring the temperature of your daemons,
feeding the dog and whatnot.

Of course, you get to share resources with a bunch of other customers.
It seems a great environment to set up a low traffic / highly customized
server, like apache+mod_perl. Now, I know and understand the services
they offer, but I have never actually used one with mod_perl.

Now, has anyone tried this services? Do I have to worry about anything?
Why didn't Stas list them in his article? -- they don't appear in the
Guide either -- Do they have a fundamental or practical flaw I can't
see?



Martin







Antwort: Re: Problem with $r-register_cleanup()

2001-02-08 Thread Michael . Jacob

There are no other handlers besides my own (content and auth) and the core
apache...

Also, I'd think that every reload of a page (that get's served by the same
Apache child) should execute the same code and handlers with the same
result---but here's the register_cleanup sometimes gets called and sometimes
not. I press Reload, Reload, Reload... and get the result as below...

Michael


Datum: 07.02.2001 23:37
An:Michael Jacob/EXT/GAD@GAD
Kopie: [EMAIL PROTECTED]

Betreff:   Re: Problem with $r-register_cleanup()
Nachrichtentext:


Is it possible that another handler (such as CGI, or parsed-html) is
taking over before yours and exiting or returning OK.

Rob

Hi,

I just ran into a problem with $r-register_cleanup() only sometime beeing
called.

This is mod_perl 1.24_01, perl 5.6.0, apache 1.3.14 compiled with gcc 5.6.0 on
AIX 4.3.3.

Here's a sample code (snippet):

sub handler { # PerlTransHandler
  my $r = shift;
  $r-register_cleanup(\clean1);
  $r-push_handlers(PerlCleanupHandler = \clean2);
  $r-pnotes('cleanup', bless {} );
  print STDERR 'in ";
  return DECLINE;
}

sub clean1 { print STDERR "register_cleanup "; }
sub clean2 { print STDERR "push_handlers "; }
sub DESTROY { print STDERR "DESTROY\n"; }

And that's the error_log:

in register_cleanup push_handlers DESTROY
in register_cleanup push_handlers DESTROY
in push_handlers DESTROY
in push_handlers DESTROY
in push_handlers DESTROY
in register_cleanup push_handlers DESTROY
in push_handlers DESTROY
in push_handlers DESTROY
in push_handlers DESTROY
in push_handlers DESTROY
in push_handlers DESTROY
in push_handlers DESTROY
in push_handlers DESTROY
in push_handlers DESTROY
in register_cleanup push_handlers DESTROY
in push_handlers DESTROY


The pushed handler only get's called about a third or less of the time. :-(

Any idea, bug?

Michael Jacob

PS: Yes I did some tests with -x...


Robert L. Landrum
Senior Programmer
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"It's working correctly.  It's simply working in contrast to what you have
perceived to be correct."







Problem with $r-register_cleanup()

2001-02-07 Thread Michael . Jacob

Hi,

I just ran into a problem with $r-register_cleanup() only sometime beeing
called.

This is mod_perl 1.24_01, perl 5.6.0, apache 1.3.14 compiled with gcc 5.6.0 on
AIX 4.3.3.

Here's a sample code (snippet):

sub handler { # PerlTransHandler
  my $r = shift;
  $r-register_cleanup(\clean1);
  $r-push_handlers(PerlCleanupHandler = \clean2);
  $r-pnotes('cleanup', bless {} );
  print STDERR 'in ";
  return DECLINE;
}

sub clean1 { print STDERR "register_cleanup "; }
sub clean2 { print STDERR "push_handlers "; }
sub DESTROY { print STDERR "DESTROY\n"; }

And that's the error_log:

in register_cleanup push_handlers DESTROY
in register_cleanup push_handlers DESTROY
in push_handlers DESTROY
in push_handlers DESTROY
in push_handlers DESTROY
in register_cleanup push_handlers DESTROY
in push_handlers DESTROY
in push_handlers DESTROY
in push_handlers DESTROY
in push_handlers DESTROY
in push_handlers DESTROY
in push_handlers DESTROY
in push_handlers DESTROY
in push_handlers DESTROY
in register_cleanup push_handlers DESTROY
in push_handlers DESTROY


The pushed handler only get's called about a third or less of the time. :-(

Any idea, bug?

Michael Jacob

PS: Yes I did some tests with -x...





Antwort: RFC: DBI::Prof

2000-11-30 Thread Michael . Jacob

Hi,

I'm not quite sure, but I think the following would produce wrong results,
wouldn't it?

$sth1 = $dbh-prepare(...);
$sth2 = $dbh-prepare(...);
$sth1-execute();
$sth3 = $dbh-prepare(...);
$sth2-execute();
$sth3-execute();

Michael Jacob


Datum: 28.11.2000 21:12
An:mod_perl list [EMAIL PROTECTED]


Betreff:   RFC: DBI::Prof
Nachrichtentext:


I have a huge project with lots of tables, and the performance wasn't that
well. So I've started to review the tables definitions and have found that
some indices were missing. I was sick from doing the tracing of all
possible SQL calls manually, so I wrote this simple profiler. Take a look
and tell me if you think it worths releasing on CPAN...

hmm, why mod_perl list... because it works under mod_perl :) In fact I
didn't test it under non mod_perl but it should work as well :)

Anyway, enjoy :)


_
Stas Bekman  JAm_pH --   Just Another mod_perl Hacker
http://stason.org/   mod_perl Guide  http://perl.apache.org/guide
mailto:[EMAIL PROTECTED]   http://apachetoday.com http://jazzvalley.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/



 Prof.pm



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Antwort: trying to isolate VirtualHosts running identical .pm's

2000-11-17 Thread Michael . Jacob

Hi,

just use magic...:

1. move your test modules to /path/TEST/YourPrefix/name.pm
2. add /path to @INC (NOT /path/TEST !)
3. add PerlSetVar test TRUE for your test virtual host and change the
PerlHandlers to read TEST::YourPrefix::name
4. write a Filter that does something like
if ($r-dir_config('test') {
  s/YourPrefix::/TEST::YourPrefix::/g;
}
5. USE your new Filter in all Modules BEFORE the "package"-line

Now Perl will see your test modules as TEST::YourPrefix::name and the normal
modules als YourPrefix::name. No changes are necessary when migrating tested
modules to production.

Abracadabra and done.

cu/2

Michael Jacob

PS: Or just run 2 Apache instances with different @INCs. That's easier...


Datum: 17.11.2000 17:15
An:[EMAIL PROTECTED]


Betreff:   trying to isolate VirtualHosts running identical .pm's
Nachrichtentext:


I'm trying to configure a single box to host completely separate instances
of development and test versions of the same code base (currently 49
modules).

Right now I have 2 virtual hosts configured on the same IP and servername,
but use different ports, i.e., 80 and 82.

I attempted to use
PerlSetEnv PERL5LIB
/usr/local/lib/perl5/site_perl/5.005/sun4-solaris:/path/to/mydevel
or,
PerlSetEnv PERL5LIB
/usr/local/lib/perl5/site_perl/5.005/sun4-solaris:/path/to/test
in each respective's VirtualHost section, but this did not work.

/perl-status?inc always shows:
   @INC =
/usr/local/lib/perl5/5.00503/sun4-solaris
/usr/local/lib/perl5/5.00503
/usr/local/lib/perl5/site_perl/5.005/sun4-solaris
/usr/local/lib/perl5/site_perl/5.005
.
/usr/local/apache/
/usr/local/apache/lib/perl
I then tried PerlVINC (version 0.03) by adding to my devel virtualhost
section:

  PerlModule Apache::PerlVINC
  PerlINC /path/to/mydevel/
  PerlFixupHandler Apache::PerlVINC
  PerlCleanupHandler Apache::PerlVINC
#  PerlVersion Apache::TicketMaster
but then get an error if I uncomment out the above line, saying that it
can't locate TicketMaster in @INC ...

Assuming I could get the above to work for a single module (by reloading it
with PerlVersion), is there any way to globally force the server to execute
the proper module, depending on which virtualhost it's serving, without
having to explicitly do a reload of each individual module (potentially 
50)?

Thanks in advance,

Scott











-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]