Re: Apache::Session and pnotes

2003-09-02 Thread Perrin Harkins
Xavier Noria wrote:
It seems, however, that Apache::Session objects stop being stored when I 
put the session in pnotes() with a code analogous to this:
Can you tell us more about the problem is?  What do you see when you 
take the session hash back out of pnotes?

my $r = Apache::Request-instance(shift);
No need to involve Apache::Request just for this.  Your handler should 
be getting $r passed to it.

tie my (%session), 'Apache::Session::Oracle', undef,
  {Handle = $class-dbh(), Commit = 1};

$r-pnotes(session = \%session);
Show us the code you use to get it back.

- Perrin



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


Re: Apache::Session extra record not write to Mysql db.

2003-09-02 Thread Perrin Harkins
James.Q.L wrote:
before i had three fields in table sessions : a_session,id,time in the DB.
Did you add code of your own to update the time column?

and updating table etc from the program was working just fine. however, after i added 
one more
field (username) to the sessions table through phpmysql, updating it in the program
seems has no effect on the username record. no problem on others.
Do you understand what Apache::Session does?  It simply use Storable to 
turn the whole hash of values into a single binary chunk and stores it 
all in the a_session field.  It uses the id field to find the session 
again.  It will not update any other fields unles syou hack the code 
yourself.

$session{'test'} = time();## this doesn't update 'test'
That updates the field test in the session, which is stored as part of 
the column a_session in the database.

$session{'uname'} = $uname if $uname;  ## this doesn't update 'uname'
Same as above -- it updates the uname value of the session.

$session{'time'} = time();## this updates 'time' record
But it doesn't update the time column in the database unless you hacked 
the Apache::Session code to do that.

- Perrin



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


Re: Apache::Session extra record not write to Mysql db.

2003-09-02 Thread James.Q.L

--- Perrin Harkins [EMAIL PROTECTED] wrote:
 James.Q.L wrote:
  before i had three fields in table sessions : a_session,id,time in the DB.
 
 Did you add code of your own to update the time column?
 

no.

  and updating table etc from the program was working just fine. however, after i 
  added one more
  field (username) to the sessions table through phpmysql, updating it in the program
  seems has no effect on the username record. no problem on others.
 
 Do you understand what Apache::Session does?  It simply use Storable to 
 turn the whole hash of values into a single binary chunk and stores it 
 all in the a_session field.  It uses the id field to find the session 
 again.  It will not update any other fields unles syou hack the code 
 yourself.

I read the doc of Apache::Session::Store::Mysql but there isn't much in it.
and i tried first to have a 'time' field in the sessions table. and it did get 
updated. so that's why i thought the record get stored just like that.

and from my phpmysql, you can see the time record.

id   a_session time unametest  
0543f2dc8dd196c5adeb29f18113f88d  2003090122521800 

and indeed as you said in record a_session it stores the session data. so if i 
understand
correctly, i don't add _new_ column to the sessions table, instead i call 
$session{'username'} =
'username' which add it to the column a_session.



  $session{'time'} = time();## this updates 'time' record
 
 But it doesn't update the time column in the database unless you hacked 
 the Apache::Session code to do that.
 

now i don't know why the time record gets updated. isn't it suppose to update the one 
in
a_session?

one more question if you don't mind.

i know Apache::Session can't do session managerment directly. but i found out that 
when a user
session timeout, the record also gone automatically.is tied(%session)-delete; delete 
the session?


Thanks

Qiang

__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com


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



Re: Apache::Session extra record not write to Mysql db.

2003-09-02 Thread Anton Permyakov
   $session{'time'} = time();## this updates 'time' record
 
  But it doesn't update the time column in the database unless you hacked
  the Apache::Session code to do that.
 

 now i don't know why the time record gets updated. isn't it suppose to
update the one in
 a_session?

I guess 'time' field gets updated because of it is 'timestamp' type, isn't
it?
MySQL has this type for automatically updated field with current date and
time (RTFM :)).

Best wishes,
Anton Permyakov.





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



Re: Apache::Session extra record not write to Mysql db.

2003-09-02 Thread Perrin Harkins
On Tue, 2003-09-02 at 00:13, James.Q.L wrote:
 --- Perrin Harkins [EMAIL PROTECTED] wrote:
  Did you add code of your own to update the time column?
  
 
 no.

Maybe you added the time column as an automatic timestamp column?  There
is no time column in the schema described in the Apache::Session
documentation.

 and from my phpmysql, you can see the time record.
 
 id   a_session time unametest  
 0543f2dc8dd196c5adeb29f18113f88d  2003090122521800 

Is that a real column, or just a last-modified time that phpmysql adds
in somehow?

 and indeed as you said in record a_session it stores the session data. so if i 
 understand
 correctly, i don't add _new_ column to the sessions table, instead i call 
 $session{'username'} =
 'username' which add it to the column a_session.

That's right.

 i know Apache::Session can't do session managerment directly. but i found out that 
 when a user
 session timeout, the record also gone automatically.is tied(%session)-delete; 
 delete the session?

Apache::Session has no concept of timeouts so it never deletes sessions,
but you can delete sessions manually with the delete method that you're
talking about.

By the way, you might find it easier to use CGI::Session.  It works fine
with mod_perl, and it directly supports things like timeouts.

- Perrin



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



Re: Apache::Session and pnotes

2003-09-02 Thread Xavier Noria
On Tuesday 02 September 2003 07:46, you wrote:

(I am sorry I am not replying to the actual email, but to a forwarded 
copy from my desktop at home.)

  It seems, however, that Apache::Session objects stop being stored
  when I put the session in pnotes() with a code analogous to this:

 Can you tell us more about the problem is?  What do you see when you
 take the session hash back out of pnotes?

I have dumped the hash in a content handler and it seems to be OK.

  my $r = Apache::Request-instance(shift);

 No need to involve Apache::Request just for this.  Your handler
 should be getting $r passed to it.

Apache::Request is used because the authenticator handles login via 
param(), and more handlers need the parameters afterwards. 

  tie my (%session), 'Apache::Session::Oracle', undef,
{Handle = $class-dbh(), Commit = 1};
 
  $r-pnotes(session = \%session);

 Show us the code you use to get it back.

When a request is received the session id is retrieved from a cookie. 
The schema (with some irrelevant checks removed) would be this:

my %cookies = Apache::Cookie-fetch;
my $cookie = $cookies{COOKIE_NAME()};
my $session_id = $cookie-value;
my %session;
eval {
tie %session, 'Apache::Session::Oracle', $session_id,
  {Handle = $class-dbh(), Commit = 1};
};

The eval block is there now because it seems Apache::Session::Oracle 
dies if it cannot retrieve the session.

That code works all right if \%session is not stored in pnotes(), but if 
it is put the session is not read back from the database and I have 
checked from a database client that there is no new row written.

I am doing basic stuff with this, so if it sounds strange it is likely 
that I doing something wrong.

-- fxn



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



ANNOUCE: Loggerithim 6.4.1

2003-09-02 Thread Cory 'G' Watson
Loggerithim is a package for monitoring, visualizing, and managing your 
systems using remote agents and a web interface.

Changes in this version:
Frontend:
	- Remove some unnecessary code from Lists object.
	- Bring Commander up-to-date with Agent interface
Agent:
	- Fix issues with agent's ftp_putfile task
	- Add support for 'qfe' cards in Solaris
	- Add experimental solaris_devices plugin for CPU info and disk error 
detection
	- misc cleanups

For more information visit:

http://www.loggerithim.org

Cory 'G' Watson
http://www.loggerithim.org


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


post max and MP2

2003-09-02 Thread Tofu Optimist
Hello -- 

I'm moving a module from MP1 to MP2.
What is the MP2 equivalent of this code?
Thanks!

code
my $q = Apache::Request-new($r,
POST_MAX = 10 * 1024,  
DISABLE_UPLOADS = 1);  
$q-no_cache(1);
/code

__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com


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



post max and MP2

2003-09-02 Thread Tofu Optimist
Hello -- 

I'm moving a module from MP1 to MP2.
What is the MP2 equivalent of this code?
Thanks!

code
my $q = Apache::Request-new($r,
POST_MAX = 10 * 1024,  
DISABLE_UPLOADS = 1);  
$q-no_cache(1);
/code

__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com


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



collecting unique client (computer) specific info?

2003-09-02 Thread kfr
Any one out there know of some way, either from java or SLL or some other
combination, to collect any kind of machine specific information from a web
client logging into a site with SSL (Apache/mod_perl mod_ssl)?  I need to
find some way to uniquely identify a 'machine', like possible grabbing it's
mac address would be ideal but obviously that can't be done ...

Any clues?

Kirk



-Original Message-
From: Tofu Optimist [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 02, 2003 8:57 AM
To: [EMAIL PROTECTED]
Subject: post max and MP2


Hello --

I'm moving a module from MP1 to MP2.
What is the MP2 equivalent of this code?
Thanks!

code
my $q = Apache::Request-new($r,
   POST_MAX = 10 * 1024,
   DISABLE_UPLOADS = 1);
$q-no_cache(1);
/code

__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com


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





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



Re: Apache::Session and pnotes

2003-09-02 Thread Perrin Harkins
On Tue, 2003-09-02 at 05:02, Xavier Noria wrote:
  Can you tell us more about the problem is?  What do you see when you
  take the session hash back out of pnotes?
 
 I have dumped the hash in a content handler and it seems to be OK.

Okay, then what is the problem that you're asking for help with here?

 When a request is received the session id is retrieved from a cookie. 
 The schema (with some irrelevant checks removed) would be this:
 
 my %cookies = Apache::Cookie-fetch;
 my $cookie = $cookies{COOKIE_NAME()};
 my $session_id = $cookie-value;
 my %session;
 eval {
 tie %session, 'Apache::Session::Oracle', $session_id,
   {Handle = $class-dbh(), Commit = 1};
 };

Okay, but I was asking how you get it back from pnotes.

 That code works all right if \%session is not stored in pnotes(), but if 
 it is put the session is not read back from the database and I have 
 checked from a database client that there is no new row written.

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.

- Perrin


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



Re: post max and MP2

2003-09-02 Thread Issac Goldstand
Right now Apache::Request is in the final proting stages... Until it's done,
jjust request Apache::Request with CGI

  Issac

- Original Message - 
From: Tofu Optimist [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, September 02, 2003 6:43 PM
Subject: post max and MP2


 Hello -- 

 I'm moving a module from MP1 to MP2.
 What is the MP2 equivalent of this code?
 Thanks!

 code
 my $q = Apache::Request-new($r,
 POST_MAX = 10 * 1024,
 DISABLE_UPLOADS = 1);
 $q-no_cache(1);
 /code

 __
 Do you Yahoo!?
 Yahoo! SiteBuilder - Free, easy-to-use web site design software
 http://sitebuilder.yahoo.com


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





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



Re: PATCH porting.pod First Mystery

2003-09-02 Thread Stas Bekman
Brian McCauley wrote:
[...]
Nice, but:

 +The easiest and the fastest way to solve the nested subroutines
 +problem is to change Cmy to Clocal Cour for all variables for
 +which you get the warning.  The Chandler subroutines are never
...
[...]
 +  local our $counter = 0;
local our? That should be either local or our, but not both.


No.


Do I miss something?


Yes.  (I tried to explain this in Paris but I was in danger of causing
you to miss lunch completely).
local() and our() do two quite separate and complementary things.

our() (in effect) declares a lexically scoped alias for a package
variable.
local() restores the old value of a package variable (usually undef)
at the end of the current lexical scope.
In effect you use local() to undef the variable, instead of explicitly 
initializing it. Why not doing this explictly?

so instead of replacing:

my $counter;

with:

local our $counter;

it's probably better to say:

our $counter = 0;

or if you insist on using both:

our $counter;
local $counter; # undef $counter
later on I show why this is better for user's understanding.

The two combined therefore give a package variable two of the most
useful properties of a lexical one.  Of course a real lexical variable
doesn't really become undefined when it does out of scope - it really
becomes anonymous, and iff there are no remaining (unweakened)
references it then gets GCed.  But for file-scoped lexicals in the
main script file the difference is usually not that important.  Both
effectively get killed at the point where global destruction would
have taken place.
 

The rest looks good, but that's not the simplest solution as you have
to modify the variables.


Is there a simpler one?  For a typical script with say half a dozen
variables the would not remain shared the local our solution
requires a dozen keystokes on each of half a dozen lines.
Don't forget that our() is not available before perl 5.6. So we can't quite 
eliminate the previous solution unless you suggest to go with a 
back-compatible version:

use vars qw($counter);
local $counter;
and of course the proper solution is:

use vars qw($counter);
$counter = 0; # or undef
which is documented in the perl reference section.

Granted, the original simplest solution has its troubles.


The original simplest solution involved finding (and subsequently
maintaining) a globally unique filename then splitting the program in
to two parts.  Thereafer you have to maintain two files even on CGI
servers.  I would contend that this simple solution is not simple.
If you are going to all that troble you may as well to the extra
804.65m and produce a proper mod_perl handler and a small wrapper to
make it work also in a CGI environment.  Also, as of mod_perl2, the
simple solution is not even, as it stands, a solution as it relied
on the script being in the CWD.
Remember, we are talking about mp1 guide patching. Not everything that applies 
to mp1 applies to mp2. e.g., mp2 requires 5.6+, so we indeed can rely on using 
our() there. And I hope that the problem with CWD will be resolved once Arthur 
will fix that.

If you think that using globals + their initialization is a better solution, 
which will work well in mp1 and mp2, we can replace the lib.pl solution with 
it, but should add it to the perl reference section.

__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


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


RE: collecting unique client (computer) specific info?

2003-09-02 Thread kfr
Yes, sorry.  I have a site that allows my customers to become members via
monthly credit card subscription.  The problem is we've been getting
fraudulent credit card transactions and need some mechanism to detect a user
who is a repeat offender so I can detect them trying to submit yet another
bogus CC for access.  The only way that I'm aware of to do that is to grab
something specific to that piece of hardware or computer.  Does that make
sense? ... impossible? ... or is there a better way?

K



-Original Message-
From: Perrin Harkins [mailto:[EMAIL PROTECTED]
Sent: Monday, September 01, 2003 10:35 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: collecting unique client (computer) specific info?


On Tue, 2003-09-02 at 13:24, kfr wrote:
 Any one out there know of some way, either from java or SLL or some other
 combination, to collect any kind of machine specific information
from a web
 client logging into a site with SSL (Apache/mod_perl mod_ssl)?  I need to
 find some way to uniquely identify a 'machine', like possible
grabbing it's
 mac address would be ideal but obviously that can't be done ...

 Any clues?

Perhaps you could explain what you're trying to do?

- Perrin




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



self_url MP2 w/o CGI

2003-09-02 Thread Tofu Optimist
Hi folks --

I'm using MP2, and I am trying to avoid loading CGI
for 2 reasons: 

(1) To save memory. 

(2) When I do load CGI, it fails at the require
Apache (line 161), and I'd prefer not to edit CGI on
my server.  Uck.

Given I'm not loading CGI, how can I determine
self_url() in MP2?

I tried something like this
code
my $self_uri = APR::URI-parse($r-pool,
$r-uri)-unparse;
$r-headers_out-set(Location = $self_uri .
r2=1);
return Apache::REDIRECT;
/code
but this gives me a partial URL, not the full
expansion.

Thanks for any assistance.

-TO


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com


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



Re: self_url MP2 w/o CGI

2003-09-02 Thread Stas Bekman
Tofu Optimist wrote:
Hi folks --

I'm using MP2, and I am trying to avoid loading CGI
for 2 reasons: 

(1) To save memory. 

(2) When I do load CGI, it fails at the require
Apache (line 161), and I'd prefer not to edit CGI on
my server.  Uck.
Given I'm not loading CGI, how can I determine
self_url() in MP2?
I tried something like this
code
my $self_uri = APR::URI-parse($r-pool,
$r-uri)-unparse;
$r-headers_out-set(Location = $self_uri .
r2=1);
return Apache::REDIRECT;
/code
but this gives me a partial URL, not the full
expansion.
$r-construct_url;

From the C docs:

/* Used for constructing self-referencing URLs, and things like SERVER_PORT,
 * and SERVER_NAME.
 */
/**
 * build a fully qualified URL from the uri and information in the request rec
 * @param p The pool to allocate the URL from
 * @param uri The path to the requested file
 * @param r The current request
 * @return A fully qualified URL
 * @deffunc char *ap_construct_url(apr_pool_t *p, const char *uri, 
request_rec *r)
 */
AP_DECLARE(char *) ap_construct_url(apr_pool_t *p, const char *uri, 
request_rec *r);

__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


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


Re: Apache::Session and pnotes

2003-09-02 Thread Xavier Noria
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.

Is it better now?

-- fxn




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



RE: collecting unique client (computer) specific info?

2003-09-02 Thread Perrin Harkins
On Tue, 2003-09-02 at 14:23, kfr wrote:
 Yes, sorry.  I have a site that allows my customers to become members via
 monthly credit card subscription.  The problem is we've been getting
 fraudulent credit card transactions and need some mechanism to detect a user
 who is a repeat offender so I can detect them trying to submit yet another
 bogus CC for access.

Okay, that makes sense.  Unfortunatey, there's no foolproof way that I'm
aware of.  To begin with, you can try using a cookie.  This will stop
anyone who is not very technical.  Beyond that, I have heard that
there's some kind of unique identifier in SSL that you may be able to
use.  I know this because the f5 big/ip load balancers used it.  Check
into that.

- Perrin


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



Re: collecting unique client (computer) specific info?

2003-09-02 Thread Perrin Harkins
On Tue, 2003-09-02 at 13:24, kfr wrote:
 Any one out there know of some way, either from java or SLL or some other
 combination, to collect any kind of machine specific information from a web
 client logging into a site with SSL (Apache/mod_perl mod_ssl)?  I need to
 find some way to uniquely identify a 'machine', like possible grabbing it's
 mac address would be ideal but obviously that can't be done ...
 
 Any clues?

Perhaps you could explain what you're trying to do?

- Perrin


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



Re: self_url MP2 w/o CGI

2003-09-02 Thread Stas Bekman
Tofu Optimist wrote:
Thanks.  How do I call construct_uri?
You just call $r-construct_url. In your example that would be:

   $r-headers_out-set(Location = $r-construct_url . r2=1);

__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


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


Re: self_url MP2 w/o CGI

2003-09-02 Thread Stas Bekman
[please keep the thread on the list!]

Tofu Optimist wrote:
:(

[Tue Sep 02 15:22:53 2003] [error] [client
192.168.1.2] Can't locate object method
construct_url via package Apache::RequestRec at
/home//mod-perl/Redirect.pm line 59.
Do I need to load it or something?
in mp2 you need to load modules that contain the methods that you want to use:

% lookup construct_url
To use method 'construct_url' add:
use Apache::URI ();
See:
http://perl.apache.org/docs/2.0/user/porting/porting.html#Porting_a_Perl_Module_to_Run_under_mod_perl_2_0

You just call $r-construct_url. In your example
that would be:
   $r-headers_out-set(Location =
$r-construct_url . r2=1);

__

Stas BekmanJAm_pH -- Just Another
mod_perl Hacker
http://stason.org/ mod_perl Guide ---
http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org
http://apacheweek.com
http://modperlbook.org http://apache.org  
http://ticketmaster.com



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


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com


--

__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


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


Custom Log files Under MP2

2003-09-02 Thread Tofu Optimist
I would like to append a small line of log information
to a file on certain apache2 requests.  For this
application, I am very concerned about speed, so i'm
looking for fast simple solutions. 

I could stuff the information in the error log as per
http://perl.apache.org/docs/2.0/api/Apache/Log.html, 
and parse it out later off-line, but I'd prefer to
reserve the error log for errors.

I could stuff the information in the access log, and
likewise pull out the data later off-line: how might I
get data to the access_log?

The most natural place to append the information would
be a dedicated file.  I've never written to a file
from mod_perl, and don't know the correct idiom
(flock? etc?) to do so.  

I'd appreciate any pointers to recipes, modules, etc.
to show me the correct (fast, reliable) way to append
to a file under MP2.

Thanks!

:)

__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com


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



Re: Custom Log files Under MP2

2003-09-02 Thread Stas Bekman
Tofu Optimist wrote:
I would like to append a small line of log information
to a file on certain apache2 requests.  For this
application, I am very concerned about speed, so i'm
looking for fast simple solutions. 

I could stuff the information in the error log as per
http://perl.apache.org/docs/2.0/api/Apache/Log.html, 
and parse it out later off-line, but I'd prefer to
reserve the error log for errors.

I could stuff the information in the access log, and
likewise pull out the data later off-line: how might I
get data to the access_log?
The most natural place to append the information would
be a dedicated file.  I've never written to a file
from mod_perl, and don't know the correct idiom
(flock? etc?) to do so.  

I'd appreciate any pointers to recipes, modules, etc.
to show me the correct (fast, reliable) way to append
to a file under MP2.
You may want to spend some time with the mp2 docs first.
http://perl.apache.org/docs/2.0/user/
Your particular question is answered at these locations:
http://perl.apache.org/docs/2.0/user/handlers/http.html#PerlLogHandler
http://perl.apache.org/docs/2.0/user/handlers/server.html#Startup_Phases_Demonstration_Module
As for flocking, I prefer to do that, even though there are claims that short 
writes are atomic. It's probably not the same on all io implementations.

__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


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


Re: Custom Log files Under MP2

2003-09-02 Thread Geoffrey Young


Tofu Optimist wrote:
I would like to append a small line of log information
to a file on certain apache2 requests.  For this
application, I am very concerned about speed, so i'm
looking for fast simple solutions. 
if speed is the concern, just stick to apache's native logging mechanism.

see recipe 16.5, Conditional Logging in the mod_perl developer's cookbook:

http://www.modperlcookbook.org/chapters/ch16.pdf

in mod_perl 2.0, it's still $r-subprocess_env(), but you need to load 
APR::Table first.

HTH

--Geoff



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