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

2003-07-23 Thread Fatih Gey

- Original Message - 
From: Martin Wickman [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, July 21, 2003 4:41 PM
Subject: Re: [QUESTION] Can't read out verified username (auth)


 On Mon, Jul 21, 2003 at 12:36:55PM +0200, Fatih Gey wrote:
   On Mon, Jul 21, 2003 at 01:05:58AM +0200, Fatih Gey wrote:

i was writing my own AuthHandler with modperl v2 (v1.99_09).
   
   [...]
   
After having entered user/pass via html-form, this authentification
does his job well, but on the following request (on same browser)
$obj-user doesnt seem to return any value.. so this handler tries
to compare http post data ( which arent present this time) with
userdata in mysql-table.. resulting in an Auth_Required error.
   
   Well, how do you suppose that the browser should know how and what
   credentials to send? 
   
   Unless you (a) create a session-cookie, (b) encode a session-kei into
   each url or (c) use the simple but proper Basic Authentication scheme,
   there is no way to accomplish this. And from what I gather you are not
   doing any of that?
   
 
  I supposed the browser to resend always an unique bowser session
  id, which is used by apache to save certain values, like
  $ENV{'REMOTE_USER'} (similiar to a session-cookie with uid and
  serverbased $vars) ..  Isn't this the way Basic Authentication
  scheme works ? ..
 
 Nope. When the browser gets a 401 response from the server, it will
 (most likely) pop up a dialog asking the user for name and
 password. These credentials gets mangled into an Authorization header
 which gets sent with the next request once the user klicks OK in the
 dialog. Now, you can perform your authen-code as you like.
 
 Cookies and forms' got nothing to do with it, really.
 
 Read more here: http://www.faqs.org/rfcs/rfc2617.html
 
 
 

Oh OK.., now i get it: In Basic Auth-Scheme, the Useragent -after getting the 
required user and pass info from Client- resends his Authorization-String in every 
Requestheader
submitted to the Server. So the webserver have not to recognize an already authorized 
user,
as long as he's possible to authorize the user on every request.

So there's no way, to use an http-form instead of browser's ugly authorization-box and 
perfrom the 
Basic Authorization (without Cookies or taking an sessionkey with the url)? 







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

2003-07-21 Thread Martin Wickman
On Mon, Jul 21, 2003 at 01:05:58AM +0200, Fatih Gey wrote:
 
 i was writing my own AuthHandler with modperl v2 (v1.99_09).

[...]

 After having entered user/pass via html-form, this authentification
 does his job well, but on the following request (on same browser)
 $obj-user doesnt seem to return any value.. so this handler tries
 to compare http post data ( which arent present this time) with
 userdata in mysql-table.. resulting in an Auth_Required error.

Well, how do you suppose that the browser should know how and what
credentials to send? 

Unless you (a) create a session-cookie, (b) encode a session-kei into
each url or (c) use the simple but proper Basic Authentication scheme,
there is no way to accomplish this. And from what I gather you are not
doing any of that?



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

2003-07-21 Thread Fatih Gey
 On Mon, Jul 21, 2003 at 01:05:58AM +0200, Fatih Gey wrote:
  
  i was writing my own AuthHandler with modperl v2 (v1.99_09).
 
 [...]
 
  After having entered user/pass via html-form, this authentification
  does his job well, but on the following request (on same browser)
  $obj-user doesnt seem to return any value.. so this handler tries
  to compare http post data ( which arent present this time) with
  userdata in mysql-table.. resulting in an Auth_Required error.
 
 Well, how do you suppose that the browser should know how and what
 credentials to send? 
 
 Unless you (a) create a session-cookie, (b) encode a session-kei into
 each url or (c) use the simple but proper Basic Authentication scheme,
 there is no way to accomplish this. And from what I gather you are not
 doing any of that?
 
I supposed the browser to resend always an unique bowser session id, which
is used by apache to save certain values, like $ENV{'REMOTE_USER'}
(similiar to a session-cookie with uid and serverbased $vars) .. 
Isn't this the way Basic Authentication scheme works ? .. 





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

2003-07-21 Thread Thomas Klausner
Hi!

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

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

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

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

* Apache::AuthCookie

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

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


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

2003-07-21 Thread Martin Wickman
On Mon, Jul 21, 2003 at 12:36:55PM +0200, Fatih Gey wrote:
  On Mon, Jul 21, 2003 at 01:05:58AM +0200, Fatih Gey wrote:
   
   i was writing my own AuthHandler with modperl v2 (v1.99_09).
  
  [...]
  
   After having entered user/pass via html-form, this authentification
   does his job well, but on the following request (on same browser)
   $obj-user doesnt seem to return any value.. so this handler tries
   to compare http post data ( which arent present this time) with
   userdata in mysql-table.. resulting in an Auth_Required error.
  
  Well, how do you suppose that the browser should know how and what
  credentials to send? 
  
  Unless you (a) create a session-cookie, (b) encode a session-kei into
  each url or (c) use the simple but proper Basic Authentication scheme,
  there is no way to accomplish this. And from what I gather you are not
  doing any of that?
  

 I supposed the browser to resend always an unique bowser session
 id, which is used by apache to save certain values, like
 $ENV{'REMOTE_USER'} (similiar to a session-cookie with uid and
 serverbased $vars) ..  Isn't this the way Basic Authentication
 scheme works ? ..

Nope. When the browser gets a 401 response from the server, it will
(most likely) pop up a dialog asking the user for name and
password. These credentials gets mangled into an Authorization header
which gets sent with the next request once the user klicks OK in the
dialog. Now, you can perform your authen-code as you like.

Cookies and forms' got nothing to do with it, really.

Read more here: http://www.faqs.org/rfcs/rfc2617.html



Re: Question to mod_perl gurus. Take 1 minute. Just choose rightanswer from list!

2003-07-21 Thread Perrin Harkins
On Mon, 2003-07-21 at 07:31,   wrote:
 so the question:
 which sub main_deck will be executed?
 
 1. Hi, it's SCRIPT_1!
 2. Bye, it was SCRIPT_2!

I think #2, because it was the last one eval'ed, and you can only have
one sub with a given name in one package namespace.  Apache::ePerl does
not really support the use of in-line subs.  You have to put them in a
separate module.

- Perrin


Re: Question about Apache::Request and query strings

2003-07-14 Thread Stas Bekman
Tom Gazzini wrote:
I have a perl function which, amongst other things, needs to redirect
the request to another page.
It also needs to pass all the query parameters of the original request
(both GET and POST) to the redirected page, and also add one parameter
of it's own (an error message).
Sounds simple enough, but I'm having problems with the passing paramters
bit.
Here's what I have:

sub show_error {
my ($r, $error) = @_;
	# $r is an Apache:Request object passed by the caller

my $uri = URI-new($url);
foreach my $p (@params) {
$uri-query_form($p = $r-param($p));
}
$uri-query_form(error = $error);
$r-internal_redirect($uri-canonical);
}
But this doesn't work. The '?error=' query string gets passed, but the
orginal request query strings don't.
What am I doing wrong? And is there an easier way?
This example may help:
http://perl.apache.org/docs/1.0/guide/snippets.html#Reusing_Data_from_POST_request
__
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


Re: Question about Apache::Request and query strings

2003-06-27 Thread Swen Schillig

Tom

Where's @params coming from ?
Are you sure it's not empty ?


Swen



|-+
| |   Tom Gazzini|
| |   [EMAIL PROTECTED]|
| |   uk  |
| ||
| |   06/26/2003 04:42 |
| |   PM   |
| ||
|-+
  
--|
  |
  |
  |   To:   [EMAIL PROTECTED]
|
  |   cc:  
  |
  |   Subject:  Question about Apache::Request and query strings   
  |
  |
  |
  |
  |
  
--|



I have a perl function which, amongst other things, needs to redirect
the request to another page.

It also needs to pass all the query parameters of the original request
(both GET and POST) to the redirected page, and also add one parameter
of it's own (an error message).

Sounds simple enough, but I'm having problems with the passing paramters
bit.

Here's what I have:

sub show_error {
 my ($r, $error) = @_;

 # $r is an Apache:Request object passed by the caller

 my $uri = URI-new($url);
 foreach my $p (@params) {
 $uri-query_form($p = $r-param($p));
 }
 $uri-query_form(error = $error);
 $r-internal_redirect($uri-canonical);
}

But this doesn't work. The '?error=' query string gets passed, but the
orginal request query strings don't.

What am I doing wrong? And is there an easier way?

Thanks,
Tom








Re: [Question] Handler executing twice!?!

2003-03-31 Thread Vince Veselosky
AHA! That's the culprit! mod_dir implements this at the fix-up stage to 
allow the directive in .htaccess files, hence my confusion. Thank you 
Stas! It all makes sense now.

-Vince

Stas Bekman wrote:

Vince Veselosky wrote:
[...]
The thing that triggered it was the fact that the url was an 
index.pl file. When called as example.com/index.pl, everything 
worked as expected, but when called as example.com/, apache (or 
something) generated a subrequest for index.pl.

NOW my question is, why does apache generate the subrequest *after* 
the HeaderParser phase, causing it to execute twice? This seems like 
a pure URI translation issue, and I would expect it to happen in the 
URI translation phase, *before* the HeaderParser executes at all. I'm 
wondering if this happens in all requests, or if it is related to 
Apache::Registry in the content handler. I didn't take the time to 
track down exactly where the subrequest originates, so I'm not sure 
if it is a mod_perl issue or just an apache issue. I might one day 
build some test cases and figure it out, but not soon. Anyone have 
some insight to add?


Do you have mod_dir (DirectoryIndex) configured? It performs a 
rewrite/sub_request-redirect in the fixup stage.
http://httpd.apache.org/docs/mod/mod_dir.html
__
Stas Bekman JAm_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




Re: [Question] Handler executing twice!?!

2003-03-30 Thread Stas Bekman
Vince Veselosky wrote:

[...]

Now here is the thing. The PerlHeaderParserHandler executes TWICE for 
every request. The second time through is apparently a different Apache 
Could it be that something in your code pushes the handler on the stack again?

I'd suggest debugging with Apache::ShowRequest?
http://search.cpan.org/author/DOUGM/Apache-Module-0.11/lib/Apache/ShowRequest.pm
Do tracing:
http://perl.apache.org/docs/1.0/guide/debug.html#Debug_Tracing
Use the 'h' setting
PerlSetEnv MOD_PERL_TRACE h
Try to use $r-get_handlers() and see what you get.

Finally, if nothing helps, go with gdb.

Also what happens if you don't use Apache::Request?

__
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


Re: [Question] Handler executing twice!?!

2003-03-30 Thread Vince Veselosky
Whew, okay, I have an answer, but I also still have a question. The 
short explanation:

The bug in my code was the fact that I forgot that a request might 
also be a subrequest, so now I check if the request is_initial_req and 
short circuit if not. (And a tiny bug in my trace code caused my debug 
log to report is_initial_req as true all the time. Stupid operator 
precedence bugs!) That solves my immediate problem and gives me 
something to watch for in future.

The thing that triggered it was the fact that the url was an index.pl 
file. When called as example.com/index.pl, everything worked as 
expected, but when called as example.com/, apache (or something) 
generated a subrequest for index.pl.

NOW my question is, why does apache generate the subrequest *after* the 
HeaderParser phase, causing it to execute twice? This seems like a pure 
URI translation issue, and I would expect it to happen in the URI 
translation phase, *before* the HeaderParser executes at all. I'm 
wondering if this happens in all requests, or if it is related to 
Apache::Registry in the content handler. I didn't take the time to track 
down exactly where the subrequest originates, so I'm not sure if it is a 
mod_perl issue or just an apache issue. I might one day build some test 
cases and figure it out, but not soon. Anyone have some insight to add?

Thanks to everyone who sent help and suggestions!
-Vince Veselosky
http://ice.control-escape.com
Vince Veselosky wrote:

Now here is the thing. The PerlHeaderParserHandler executes TWICE for 
every request. The second time through is apparently a different 
Apache object from the first, as when I write to $r-notes, only the 
values from the second execution are visible to the content handler.

Now, if I comment out the PerlHeaderParserHandler line in the conf 
file, the handler never executes at all (which is expected), so it 
isn't getting pushed onto handlers from somewhere else.

Why is this thing running twice, and how can I make it stop??? I hope 
someone can hit me over the head with a clue-stick, because this thing 
is driving me completely bananas!

All help is greatly appreciated,
Vince Veselosky
http://ice.control-escape.com







Re: [Question] Handler executing twice!?!

2003-03-30 Thread Stas Bekman
Vince Veselosky wrote:
[...]
The thing that triggered it was the fact that the url was an index.pl 
file. When called as example.com/index.pl, everything worked as 
expected, but when called as example.com/, apache (or something) 
generated a subrequest for index.pl.

NOW my question is, why does apache generate the subrequest *after* the 
HeaderParser phase, causing it to execute twice? This seems like a pure 
URI translation issue, and I would expect it to happen in the URI 
translation phase, *before* the HeaderParser executes at all. I'm 
wondering if this happens in all requests, or if it is related to 
Apache::Registry in the content handler. I didn't take the time to track 
down exactly where the subrequest originates, so I'm not sure if it is a 
mod_perl issue or just an apache issue. I might one day build some test 
cases and figure it out, but not soon. Anyone have some insight to add?
Do you have mod_dir (DirectoryIndex) configured? It performs a 
rewrite/sub_request-redirect in the fixup stage.
http://httpd.apache.org/docs/mod/mod_dir.html
__
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



Re: [Question] Prototype Mismatch for Base64 under RunPerl

2003-02-17 Thread Stas Bekman
[EMAIL PROTECTED] wrote:


OS: Windows2000
Apache: 1.3.27
ModPerl: 1.27_01-dev

I have a script that ran perfectly well when not run under ModPerl but 
have recently tried to run it under modperl using the RunPerl module. It 
still seems to run OK, however my error log now seems to being filled 
with the following error messages ...

Prototype mismatch: sub 
Apache::ROOT::MSS_2dcgi::documents_2ecgi::encode_base64 vs ($;$) at 
c:/NMS/Perl/lib/Exporter.pm line 57.
Prototype mismatch: sub 
Apache::ROOT::MSS_2dcgi::documents_2ecgi::decode_base64 vs ($) at 
c:/NMS/Perl/lib/Exporter.pm line 57.

The errors are connected with the MIME::Base64 module when it defines 
the external subroutine names. The relevant section of my conf file is ...

Alias /MSS-cgi/C:/NMS/MSSWeb/cgi-bin/
Alias /MSS-js/ C:/NMS/MSSWeb/includes/
Alias /MSS-images/ C:/NMS/MSSWeb/images/

Location /MSS-cgi
AllowOverride None
Order allow,deny
Allow from all
SetHandler perl-script
PerlHandler Apache::PerlRun
Options +ExecCGI
PerlSendHeader On
/Location

I've searched all potential areas on the net with no success. Can anyone 
here assist ?

While working on the potential areas you must have missed some real resources ;)

Usually the search path is simple:

1. perl.apache.org/docs/
2. http://perl.apache.org/maillist/modperl.html#Searchable_Archives

failing to find anything at [1], I went to [2] and here you go:
http://marc.theaimsgroup.com/?l=apache-modperlw=2r=1s=Prototype+mismatchq=b

In particular this reply from Perrin seems to be most helpful:
http://marc.theaimsgroup.com/?l=apache-modperlm=100515176231857w=2
And since you haven't posted the information we ask for:
http://perl.apache.org/docs/1.0/guide/help.html#How_to_Report_Problems
I'm guessing that you are using perl 5.6.0 which may be the reason for the 
problem.

__
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



Re: Question from a newbie regarding apache and mod_perl

2003-01-06 Thread Ken Y. Clark
On Mon, 6 Jan 2003, sireesha vudatha wrote:

 Date: Mon, 6 Jan 2003 16:25:04 -0800 (PST)
 From: sireesha vudatha [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: Question from a newbie regarding apache and mod_perl


 Hi all,

 I am a beginner and am doing a course project for which I want to
 know if mod_perl is suitable for my problem at hand.

 My problem is: When a user types in a question, then my perl
 program(or whatever) has to go to the database and return the answer
 back to the user.  If its not able to find the question in the
 database, then it has to transfer the connection to a person who
 will answer the question and the database has now got to be updated
 with this new question and answer.

 (I had written a simple program using the DBI and DBD::Mysql for
 just retrieving the answer from the database)

 I don't know if the rest of my problem can be solved using mod_perl...

 Can anyone give me some ideas or suggestions that would help me out...

 Thanking u all in anticipation..

 Sireesha

Sireesha,

Nothing you descibe seems to require mod_perl.  I think perhaps you
are unclear on just what mod_perl is meant to do.  A great many people
just use mod_perl to speed up execution of their Perl scripts.  More
advanced users want to manipulate different parts of the Apache
request cycle using Perl.  It sounds like your task will be most
easily accomplished by sticking with a standard CGI script.  If you
find the performance is not what you desire, then consider running it
under Apache::Registry.

ky



Re: Question on possible effects of mod_perl on mod_cgi

2003-01-03 Thread Terra Info
That was it. I redefined Sig{__WARN__} to drop all STDERR output and my 
script output everything it was supposed to and exited cleanly. Now 
there is another bug that undoubtedly came from my trying to track down 
the original issue...
Thanks. That saved me a ton of time.
Tom

Terra Info wrote:

Ugh! I checked the users list archives but I never checked the dev 
archives. I liked p5p back in the day because it was all one in the 
same. Chaos, but oddly efficient. Thanks for the pointer.
As for the docs, I freely admit I missed it. I was not looking for 
PerlRun stuff when I went through that migration piece (I was looking 
for a different project) so when I started dealing with this I did not 
remember seeing it, therefore in my warped mind it did not exist. 
Right now, int/0 looks perfectly fine to me. Anyhow, I doubt listing 
all of them would help, just add in Apache::PerlRun into the header so 
it reads The Apache::Registry and Apache::PerlRun Families (or ~) 
and that would get people's attention a little bit better.
Thanks,
Tom

Stas Bekman wrote:

OK, now it's clear, thanks for the explanation. FWIW, there were 
discussions of possible pipes read/write deadlocks in the current 
mod_cgi implementation in Apache 2.0, so you may experience just 
that. Check the httpd-dev list archives.

[...]

   * Given that, I noticed PerlRun was no longer prominintly displayed
 in the docs 



What made you think so? The PerlRun docs weren't touched for ages.


and the migration FAQ did not to my knowledge even touch on it.




Because all you have to do is to s/Apache::/ModPerl::/ for all 
registry handlers, which includes PerlRun. Do you think that it'll 
help to explicitly list them all?

__
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





--
-
Terra Novum Research
[EMAIL PROTECTED]
www.terranovum.com
(617) 923-4132

PO Box 362
Watertown, MA 02471-0362

They that can give up essential liberty to obtain a little 
temporary safety deserve neither liberty nor safety. 
Benjamin Franklin, 
Historical Review of Pennsylvania, 1759 




Re: Question on possible effects of mod_perl on mod_cgi

2003-01-02 Thread Stas Bekman
[When starting a new thread, please remember to create a new mail, 
rather than doing a reply to one of the threads. If you don't do that, 
your mail software attaches reference ids to the original thread and 
your post gets folded into the thread you've replied to. people may 
delete the whole thread without seeing your post if they weren't 
interested in this thread. it also has an ill effect on mail archives.]

Terra Info wrote:
I am debugging a particularly nasty issue right now on a perl script 
that when written 2+ yrs ago worked fine. NB: It does not run under 
mod_perl and it has not been modified since then. 

You mean, it has never worked under mod_perl 1.0? Can you test it with 
mod_perl 1.0?

I run it from the cmd 
line (with the identical query string and all referenced %ENV vars set 
identical as well) and it runs fine. I run it as a typical CGI and it 
has problems that, in *some* ways, mirror the behavior of a poorly 
written (symptoms associated with unscoped globals, etc;) perl app under 
mod_perl. And since this is a poorly written app I am curious. Is there 
any link between mod_perl (1.99..) and mod_cgi (Apache 2)? Does mod_perl 
in anyway influence or maybe cause PerlRun like caching under mod_cgi? I 
am just trying to eliminate all possibilities as this one has been a 
real PITFA.

You can turn the debugging on and see whether it gets cached.
in ModPerl::RegistryCooker set:

use constant DEBUG = 4;

restart the server and watch error_log, compare the output of Registry 
with PerlRun.

__
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



Re: Question on possible effects of mod_perl on mod_cgi

2003-01-02 Thread Terra Info
The threads issue is my bag. I know better but was busy and distracted, 
hence I just did a reply to all and trimmed out the excess. Anyhow, I 
think you may have misunderstood my question. Although I have a specific 
issue at hand, my question was more generic. My questions are more 
related to the overall design of mod_perl and its effects on the 
functioning of Apache's other components. Anyhow, in answer to your 
question, I have not tried it under mod_perl 1 or 2 because this script 
would never function under them. It is that poorly written.

So, is there any link between mod_perl (1.99..) and mod_cgi (Apache 2)? 
Does mod_perl in anyway influence or maybe cause PerlRun like caching 
under mod_cgi? I realize the answers are probably no but I am at my wits 
end with this bug and am trying to elminate things as causes that 
normally I would not even think were related.
So you have a better handle on why I am asking, I have a script that 
runs fine from the cmd line under all parameter combinations, runs fine 
in most situations under CGI but when a few param combinations occur it 
fails to execute to completion. The odd thing is the place it hangs up 
is the line before exit;. I added a warn('foo at line nnn') after every 
line and it warns all they way to the line for exit; but never exists 
and apache tells me that the script times out. That combined with the 
fact that the script, when executed on the command line, under a faked 
up ENV that matches exactly what it gets from httpd runs flawlessly and 
to completion, seems to suggest something is happening in the in-process 
handling of the CGI script. Does that problem lie in mod_cgi, perl or in 
some funky interaction between components? With some of the symptoms I 
saw I wanted to rule out mod_perl before I went any further.
Thanks and I hope this made it more clear what I was looking for and why,
Tom

Stas Bekman wrote:

[When starting a new thread, please remember to create a new mail, 
rather than doing a reply to one of the threads. If you don't do that, 
your mail software attaches reference ids to the original thread and 
your post gets folded into the thread you've replied to. people may 
delete the whole thread without seeing your post if they weren't 
interested in this thread. it also has an ill effect on mail archives.]

Terra Info wrote:

I am debugging a particularly nasty issue right now on a perl script 
that when written 2+ yrs ago worked fine. NB: It does not run under 
mod_perl and it has not been modified since then. 


You mean, it has never worked under mod_perl 1.0? Can you test it with 
mod_perl 1.0?

I run it from the cmd line (with the identical query string and all 
referenced %ENV vars set identical as well) and it runs fine. I run 
it as a typical CGI and it has problems that, in *some* ways, mirror 
the behavior of a poorly written (symptoms associated with unscoped 
globals, etc;) perl app under mod_perl. And since this is a poorly 
written app I am curious. Is there any link between mod_perl (1.99..) 
and mod_cgi (Apache 2)? Does mod_perl in anyway influence or maybe 
cause PerlRun like caching under mod_cgi? I am just trying to 
eliminate all possibilities as this one has been a real PITFA.


You can turn the debugging on and see whether it gets cached.
in ModPerl::RegistryCooker set:

use constant DEBUG = 4;

restart the server and watch error_log, compare the output of Registry 
with PerlRun.

__
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


--
-
Terra Novum Research
[EMAIL PROTECTED]
www.terranovum.com
(617) 923-4132

PO Box 362
Watertown, MA 02471-0362

In time-keeping, in trading, in fighting, men counted numbers;
and finally, as the habit grew, only numbers counted.
  Lewis Mumford





Re: Question on possible effects of mod_perl on mod_cgi

2003-01-02 Thread Stas Bekman
Terra Info wrote:

The threads issue is my bag. I know better but was busy and distracted, 
hence I just did a reply to all and trimmed out the excess.

No prob. the comment was addressed to all subscribers.


Anyhow, I 
think you may have misunderstood my question. Although I have a specific 
issue at hand, my question was more generic. My questions are more 
related to the overall design of mod_perl and its effects on the 
functioning of Apache's other components. Anyhow, in answer to your 
question, I have not tried it under mod_perl 1 or 2 because this script 
would never function under them. It is that poorly written.

I meant the Apache::PerlRun from mod_perl 1.0. Obviously I wasn't trying 
to suggest for you to run it as a pure handler ;)

Notice that ModPerl::PerlRun and others aren't exactly the same as their 
1.0 counterparts. Due to the threading issues, currently 2.0's registry 
aren't chdir()'ing to the scripts directory. That may change in the 
future. But this may be unrelated to your problem.

So, is there any link between mod_perl (1.99..) and mod_cgi (Apache 2)? 

No.


Does mod_perl in anyway influence or maybe cause PerlRun like caching 
under mod_cgi? 

The two has nothing to do with each other.


I realize the answers are probably no but I am at my wits 
end with this bug and am trying to elminate things as causes that 
normally I would not even think were related.
So you have a better handle on why I am asking, I have a script that 
runs fine from the cmd line under all parameter combinations, runs fine 
in most situations under CGI but when a few param combinations occur it 
fails to execute to completion. The odd thing is the place it hangs up 
is the line before exit;. I added a warn('foo at line nnn') after every 
line and it warns all they way to the line for exit; but never exists 
and apache tells me that the script times out. That combined with the 
fact that the script, when executed on the command line, under a faked 
up ENV that matches exactly what it gets from httpd runs flawlessly and 
to completion, seems to suggest something is happening in the in-process 
handling of the CGI script. Does that problem lie in mod_cgi, perl or in 
some funky interaction between components? With some of the symptoms I 
saw I wanted to rule out mod_perl before I went any further.
Thanks and I hope this made it more clear what I was looking for and why,

I still don't understand you. When do you see the problem? When you run 
the script under mod_cgi or mod_perl? I don't understand why do you keep 
referring to mod_cgi.

And we are talking about Apache/mod_perl 2.0 here, right?

__
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



Re: Question on possible effects of mod_perl on mod_cgi

2003-01-02 Thread Terra Info
Stas Bekman wrote:


I still don't understand you. When do you see the problem? When you 
run the script under mod_cgi or mod_perl? I don't understand why do 
you keep referring to mod_cgi.
And we are talking about Apache/mod_perl 2.0 here, right?

No. I am talking about mod_cgi when I say mod_cgi. In short you answered 
my questions with answers I pretty much expected but I wanted my 
asumptions valiidated. For that I am grateful.
Long answer:
Let me state why I was looking (ie; the [il]logic to my thinking) to 
eliminate mod_perl from the list of of possible reasons why a standard 
CGI would be failing.

   * It was a perl CGI.
   * It was failing in ways that were similar, although not directly
 alike, ways that poorly written perl apps under mod_perl fail. For
 example, it would hangup, it would bahave oddly like there were
 variables set that should have been cleared (ie; unscoped globals).
   * It was a perl CGI. Hence I know that because of the excellent
 integration of perl into apache (perl in conf files, etc) as a
 result of mod_perl, I was looking to see if anyone here on
 mod_perl's list knew of any interactions, etc that could have
 spilled over into mod_cgi's handling of perl scripts for instance. 
   * Given that, I noticed PerlRun was no longer prominintly displayed
 in the docs and the migration FAQ did not to my knowledge even
 touch on it. I was thiking maybe it had become an automatic thing
 in mod_cgi for mod_perl enabled httpds to try to speed up perl
 CGI's by using an in-process perl interpretor instead of
 backticking it. If that was happening I figured someone here would
 probably know about it. I posted questions to apache's list but it
 has been slow going getting people knowledgable about mod_cgi to
 answer. 
   * There was more (il)logic but I think that should be enough to fill
 in the holes.

Thanks,
Tom

--
-
Terra Novum Research
[EMAIL PROTECTED]
www.terranovum.com
(617) 923-4132

PO Box 362
Watertown, MA 02471-0362

The wireless telegraph is not difficult to understand. 
The ordinary telegraph is like a very long cat. 
You pull the tail in New York, and it meows in Los Angeles. 
The wireless is the same, only without the cat.
-- Einstein




Re: Question on possible effects of mod_perl on mod_cgi

2003-01-02 Thread Stas Bekman
OK, now it's clear, thanks for the explanation. FWIW, there were 
discussions of possible pipes read/write deadlocks in the current 
mod_cgi implementation in Apache 2.0, so you may experience just that. 
Check the httpd-dev list archives.

[...]
   * Given that, I noticed PerlRun was no longer prominintly displayed
 in the docs 

What made you think so? The PerlRun docs weren't touched for ages.


and the migration FAQ did not to my knowledge even touch on it.


Because all you have to do is to s/Apache::/ModPerl::/ for all registry 
handlers, which includes PerlRun. Do you think that it'll help to 
explicitly list them all?

__
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



Re: Question on possible effects of mod_perl on mod_cgi

2003-01-02 Thread Terra Info
Ugh! I checked the users list archives but I never checked the dev 
archives. I liked p5p back in the day because it was all one in the 
same. Chaos, but oddly efficient. Thanks for the pointer.
As for the docs, I freely admit I missed it. I was not looking for 
PerlRun stuff when I went through that migration piece (I was looking 
for a different project) so when I started dealing with this I did not 
remember seeing it, therefore in my warped mind it did not exist. Right 
now, int/0 looks perfectly fine to me. Anyhow, I doubt listing all of 
them would help, just add in Apache::PerlRun into the header so it reads 
The Apache::Registry and Apache::PerlRun Families (or ~) and that 
would get people's attention a little bit better.
Thanks,
Tom

Stas Bekman wrote:

OK, now it's clear, thanks for the explanation. FWIW, there were 
discussions of possible pipes read/write deadlocks in the current 
mod_cgi implementation in Apache 2.0, so you may experience just that. 
Check the httpd-dev list archives.

[...]

   * Given that, I noticed PerlRun was no longer prominintly displayed
 in the docs 


What made you think so? The PerlRun docs weren't touched for ages.


and the migration FAQ did not to my knowledge even touch on it.



Because all you have to do is to s/Apache::/ModPerl::/ for all 
registry handlers, which includes PerlRun. Do you think that it'll 
help to explicitly list them all?

__
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


--
-
Terra Novum Research
[EMAIL PROTECTED]
www.terranovum.com
(617) 923-4132

PO Box 362
Watertown, MA 02471-0362

The wireless telegraph is not difficult to understand. 
The ordinary telegraph is like a very long cat. 
You pull the tail in New York, and it meows in Los Angeles. 
The wireless is the same, only without the cat.
-- Einstein




Re: question about using a proxy with mod_perl

2002-10-18 Thread Charlie Garrison
Good afternoon,

On 17/10/02 at 2:46 PM, Lyle Brooks [EMAIL PROTECTED] wrote:

To do what you are trying to do, I believe you'll need to use some RewriteCond
directives, something like (read: I'm just doing this from memory, you'll
need to test)...

RewriteCond %{HTTP_HOST} ^b
RewriteRule ^/(.*) http://b.blah.com:4374/$1  [P,L]


I don't think the RewriteCond is needed. I just use something like the following
to proxy all files ending in .cgi:

RewriteRule ^/(.*).cgi(.*)$http://%{HTTP_HOST}:8001/$1.cgi$2 [P]

I also have lots of domain names that need to get passed to the back-end server.
My setup gets even more fun when taking into account the internal NAT addresses
that are needed for proxying but local dns serves public external addresses. I
had a fun weekend learning about views and acl's in bind to get around that
problem. (And then patching output from oDNS to support it.)


Charlie
-- 
   Charlie Garrison[EMAIL PROTECTED]
   PO Box 141, Windsor, NSW 2756, Australia 



Re: question about using a proxy with mod_perl

2002-10-18 Thread Lyle Brooks
I believe that the Rewrite rule matches only the document root portion
of the URL.

So for a request

   http://a.blah.com/mypath/mypage.html

All you will get to match on is this much

/mypath/mypage.html

To do what you are trying to do, I believe you'll need to use some RewriteCond
directives, something like (read: I'm just doing this from memory, you'll
need to test)...

RewriteCond %{HTTP_HOST} ^b
RewriteRule ^/(.*) http://b.blah.com:4374/$1  [P,L]


Hope that helps or points you in the right direction.

Quoting Brian Hirt ([EMAIL PROTECTED]):
 
 I have a question about setting up a proxy for a mod_perl server.  I've
 got a simple proxy set up that listens on port 80 and proxies to the
 mod_perl server running on a different port.  
 
 For example. http://blah.blah.com/anything/ will go to
 http://blah.blah.com:4374/anything/  and the rules to do that are below.
 
 RewriteEngine on
 RewriteLogLevel   0
 RewriteRule   ^/(.*)$  http://blah.blah.com:4374/$1   [P,L]
 NoCache   *
 ProxyPassReverse  /  http://blah.blah.com/
 
 This is fine when you are proxying a single machine name, but how would
 i set up a proxy that would send http://a.blah.com -
 http://a.blah.com:4374,  http://b.blah.com - http://b.blah.com:4374,
 etc etc etc.  There are about 40 different names that need to be
 proxied, and it's important that the destination name is the same as the
 source machine name.
 
 It seems like something like 
 RewriteRule   ^http://([^.]+).blah.com/(.*)$   http://$1.blah.com:4374/$2
 [P,L] 
 
 should work, but it doesn't.
 
 -- 
 Brian Hirt [EMAIL PROTECTED]



Re: QUESTION - Apache::AuthenCache

2002-07-08 Thread darren chamberlain

* JOSE SOLE [EMAIL PROTECTED] [2002-07-08 14:24]:
 I am trying to use Apache::AuthenCache as my authentication handler
 for my server.  I keep getting a FORBIDDEN error each time I try to
 access the index.html page by only typing the URL up to the directory.
 
 Example:
 
 //FORBIDDEN ERROR
 http://elvis.arl.psu.edu:9092/footer
 
 //IT WORKS
 http://elvis.arl.psu.edu:9092/footer/
 http://elvis.arl.psu.edu:9092/footer/index.html

Add some debugging to the handler to ensure that the client is sending
the WWW-Authenticate header to both /footer and /footer/.  The
browser sees them as different locations (the first is a file named
footer, the second is a directory name footer), and possibly doesn't
consider the first to be within the auth realm for which it has a
username/password.

Apache's mod_dir usually Does The Right Thing here, when given the
chance; are you using a perl-handler on Location /?

(darren)

-- 
It is wrong always, everywhere and for everyone to believe
anything upon insufficient evidence.
-- W. K. Clifford, British philosopher, circa 1876



Re: Question about Work Wanted ads

2002-06-21 Thread Ask Bjoern Hansen

On Wed, 19 Jun 2002, southernstar wrote:

 I was aware that on occasion individuals are welcome to post work
 wanted ads, but I have some specific questions about how I can
 actually get some short contract work here and there, since:
[...]

Get involved with some of the open source projects; that's always
good to put on your resume.


 - ask

-- 
ask bjoern hansen, http://askbjoernhansen.com/ !try; do();




[OT] RE: Question about Work Wanted ads

2002-06-20 Thread David Harris


Marc Spitzer [mailto:[EMAIL PROTECTED]] wrote:
 3: you maybe able to deduct your volunteer work from your
 taxes( I have no idea about AU's laws though).

You can not claim donated services as a tax deduction in the US.
(Probably not other places too, I'd guess.)

The theory is this: you'd have to book both a revenue for the work you
did and a deduction for the donation. These would cancel out.

David
 




Re: [OT] RE: Question about Work Wanted ads

2002-06-20 Thread wsheldah



That's true. However, you can deduct any expenses incurred in the course of
volunteer work, such as milage to and from the site, and so forth. Again, this
is in the US, YMMV elsewhere.



David Harris [EMAIL PROTECTED] on 06/20/2002 04:04:38 PM

To:   'Marc Spitzer' [EMAIL PROTECTED],
  [EMAIL PROTECTED]
cc:(bcc: Wesley Sheldahl/Lex/Lexmark)
Subject:  [OT] RE: Question about Work Wanted ads



Marc Spitzer [mailto:[EMAIL PROTECTED]] wrote:
 3: you maybe able to deduct your volunteer work from your
 taxes( I have no idea about AU's laws though).

You can not claim donated services as a tax deduction in the US.
(Probably not other places too, I'd guess.)

The theory is this: you'd have to book both a revenue for the work you
did and a deduction for the donation. These would cancel out.

David






Re: question on apache::asp

2002-05-05 Thread Joshua Chamas

[EMAIL PROTECTED] wrote:
 
 So can I use this module to run asp.net on apache(installed on windows)?
 
 I need to run asp.net on apache(windows).
 

No.  Apache::ASP supports perl scripting for ASP v2.0 model.
ASP.net is not supported, nor C#, VBScript, etc.

-- Josh
_
Joshua Chamas   Chamas Enterprises Inc.
NodeWorks Founder   Huntington Beach, CA  USA 
http://www.nodeworks.com1-714-625-4051



Re: [QUESTION][BUG] apache dies with SIGSEGV

2002-02-26 Thread Mark P. Fister

On Tue, Feb 26, 2002 at 11:36:39AM +0100, gaston wrote:
 Hi list
 
 I wrote a small perl module using perl/Expat for parsing XML-files. 
 With apache 1.3.19 and perl 5.6.0 and Expat 2.27 it works fine. 
 In my new configuration (apache 1.3.20, perl 5.6.1 and Expat 2.30) 
 apache dies with an SIGSEGV on loading.
 
 The error occured during the function call ParseStream() in Expat.pm.
 When i checked the core file with gdb i get this:

Scope this:

http://groups.yahoo.com/group/modperl/message/39557

So try switching to Apache 1.3.23 (the latest)?

Hope this helps! :)

-- 
\_/} Mark P. Fister Java, Java, everywhere, and all\_/}
\_/} eBay, Inc. the cups did shrink; Java, Java\_/}
\_/} Austin, TX everywhere, nor any drop to drink! \_/}



Re: Question...

2002-02-14 Thread Rodney Hampton

Actually, you can use the onUnload handler in the body tag.
http://developer.netscape.com/docs/manuals/communicator/jsref/evnt24.htm

Rodney Hampton

Jon Robison wrote:
 
 On page leave?  Well I think you can of course use javascript on all the
 links on the page, but I don't believe you can do much about the user
 typing in a new url in the browser. . .
 but that's just IMHO.
 
 --Jon
 
 Ryan Parr wrote:
 
  I think I'm missing something...
 
  If you set a session cookie (i.e. one with no expiry time) then the cookie
  will be deleted immediately upon browser close, forcing the user to login
  again if they've closed their browser instance.
 
  If you don't use cookies and allow basic auth then the exact same behavior
  is called, forcing the user to re-login only if they've closed that browser
  instance.
 
  Is there someway to expire cookies on page leave, or is this the smartass
  thing you were referring to? :)
 
  -- Ryan Parr
 
  - Original Message -
  From: Jon Robison [EMAIL PROTECTED]
  To: Ron Beck [EMAIL PROTECTED]
  Cc: [EMAIL PROTECTED]
  Sent: Tuesday, February 12, 2002 12:28 PM
  Subject: Re: Question...
 
   Cookies!
  
   /me is in smartass mode today.
  
   --Jon
  
   Ron Beck wrote:
   
Hello all,
I need to know how to clear the $ENV variables.  For example, I use a
.htaccess file for specific directories which requires the user to enter
userID and password.  When they exit the page, I want them to have to
re-enter userID and passwd if they enter the page again.  Does anyone
know how this is accomplished?
   
TIA,
Ron



Re: Question...

2002-02-13 Thread Ryan Parr

I think I'm missing something...

If you set a session cookie (i.e. one with no expiry time) then the cookie
will be deleted immediately upon browser close, forcing the user to login
again if they've closed their browser instance.

If you don't use cookies and allow basic auth then the exact same behavior
is called, forcing the user to re-login only if they've closed that browser
instance.

Is there someway to expire cookies on page leave, or is this the smartass
thing you were referring to? :)

-- Ryan Parr

- Original Message -
From: Jon Robison [EMAIL PROTECTED]
To: Ron Beck [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Tuesday, February 12, 2002 12:28 PM
Subject: Re: Question...


 Cookies!

 /me is in smartass mode today.

 --Jon

 Ron Beck wrote:
 
  Hello all,
  I need to know how to clear the $ENV variables.  For example, I use a
  .htaccess file for specific directories which requires the user to enter
  userID and password.  When they exit the page, I want them to have to
  re-enter userID and passwd if they enter the page again.  Does anyone
  know how this is accomplished?
 
  TIA,
  Ron




RE: Question...

2002-02-13 Thread Burak Gürsoy

you can use sessions... there are some modules for this. Forexample,
Apache::ASP has the $Session object... or you can use javascript to delete
the cookie (maybe)

-Original Message-
From: Ryan Parr [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 13, 2002 11:00 AM
To: Jon Robison; Ron Beck
Cc: [EMAIL PROTECTED]
Subject: Re: Question...


I think I'm missing something...

If you set a session cookie (i.e. one with no expiry time) then the cookie
will be deleted immediately upon browser close, forcing the user to login
again if they've closed their browser instance.

If you don't use cookies and allow basic auth then the exact same behavior
is called, forcing the user to re-login only if they've closed that browser
instance.

Is there someway to expire cookies on page leave, or is this the smartass
thing you were referring to? :)

-- Ryan Parr

- Original Message -
From: Jon Robison [EMAIL PROTECTED]
To: Ron Beck [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Tuesday, February 12, 2002 12:28 PM
Subject: Re: Question...


 Cookies!

 /me is in smartass mode today.

 --Jon

 Ron Beck wrote:
 
  Hello all,
  I need to know how to clear the $ENV variables.  For example, I use a
  .htaccess file for specific directories which requires the user to enter
  userID and password.  When they exit the page, I want them to have to
  re-enter userID and passwd if they enter the page again.  Does anyone
  know how this is accomplished?
 
  TIA,
  Ron


_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com




Re: Question...

2002-02-13 Thread Jon Robison

On page leave?  Well I think you can of course use javascript on all the
links on the page, but I don't believe you can do much about the user
typing in a new url in the browser. . .
but that's just IMHO.

--Jon


Ryan Parr wrote:
 
 I think I'm missing something...
 
 If you set a session cookie (i.e. one with no expiry time) then the cookie
 will be deleted immediately upon browser close, forcing the user to login
 again if they've closed their browser instance.
 
 If you don't use cookies and allow basic auth then the exact same behavior
 is called, forcing the user to re-login only if they've closed that browser
 instance.
 
 Is there someway to expire cookies on page leave, or is this the smartass
 thing you were referring to? :)
 
 -- Ryan Parr
 
 - Original Message -
 From: Jon Robison [EMAIL PROTECTED]
 To: Ron Beck [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Sent: Tuesday, February 12, 2002 12:28 PM
 Subject: Re: Question...
 
  Cookies!
 
  /me is in smartass mode today.
 
  --Jon
 
  Ron Beck wrote:
  
   Hello all,
   I need to know how to clear the $ENV variables.  For example, I use a
   .htaccess file for specific directories which requires the user to enter
   userID and password.  When they exit the page, I want them to have to
   re-enter userID and passwd if they enter the page again.  Does anyone
   know how this is accomplished?
  
   TIA,
   Ron



Re: Question...

2002-02-13 Thread Steve Piner


Do you need to expire the cookie when you leave the page? How about the
following.

When they login, you send down a cookie. when they go to that page, you
check the cookie they sent, but send out a new value for that cookie,
invalidating it. So when they leave that page they send back your
invalid cookie.

When they go back to the page, they'll send the invalid cookie, and you
can then prompt them to log in or whatever.

You'll get the invalid cookie sent back for images on that page, but
that usually isn't a problem.

Steve Piner


Ryan Parr wrote:
 
 I think I'm missing something...
 
 If you set a session cookie (i.e. one with no expiry time) then the cookie
 will be deleted immediately upon browser close, forcing the user to login
 again if they've closed their browser instance.
 
 If you don't use cookies and allow basic auth then the exact same behavior
 is called, forcing the user to re-login only if they've closed that browser
 instance.
 
 Is there someway to expire cookies on page leave, or is this the smartass
 thing you were referring to? :)
 
 -- Ryan Parr
 
 - Original Message -
 From: Jon Robison [EMAIL PROTECTED]
 To: Ron Beck [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Sent: Tuesday, February 12, 2002 12:28 PM
 Subject: Re: Question...
 
  Cookies!
 
  /me is in smartass mode today.
 
  --Jon
 
  Ron Beck wrote:
  
   Hello all,
   I need to know how to clear the $ENV variables.  For example, I use a
   .htaccess file for specific directories which requires the user to enter
   userID and password.  When they exit the page, I want them to have to
   re-enter userID and passwd if they enter the page again.  Does anyone
   know how this is accomplished?
  
   TIA,
   Ron



Re: Question...

2002-02-12 Thread Uwe Voelker

 I need to know how to clear the $ENV variables.  For example, I use a
 .htaccess file for specific directories which requires the user to enter
 userID and password.  When they exit the page, I want them to have to
 re-enter userID and passwd if they enter the page again.  Does anyone
 know how this is accomplished?


Clearing %ENV will not work. You have to send a 403 response.

Uwe




Re: Question...

2002-02-12 Thread Jon Robison

Cookies!

/me is in smartass mode today.

--Jon

Ron Beck wrote:
 
 Hello all,
 I need to know how to clear the $ENV variables.  For example, I use a
 .htaccess file for specific directories which requires the user to enter
 userID and password.  When they exit the page, I want them to have to
 re-enter userID and passwd if they enter the page again.  Does anyone
 know how this is accomplished?
 
 TIA,
 Ron



Re: QUESTION

2002-02-06 Thread Tim Tompkins


if ($redirect = $shortnames-get($fname, WAIT, 1)) {
   if ($redirect !~ /$r-server()-server_hostname/) {
  $r-content_type('text/html');
  $r-header_out ( Location = $redirect ); $log-debug($redirect);

$r-send_http_header;

  return REDIRECT;
 }


Regards,

Tim Tompkins
--
Programmer
http://www.arttoday.com/
http://www.rebelartist.com/
--
- Original Message -
From: Martin Haase-Thomas
To: [EMAIL PROTECTED]
Sent: Wednesday, February 06, 2002 8:21 AM
Subject: QUESTION


Hi all,

I hope there'll be someone here to help we with a mod_perl prob, of
which I thought first it wouldn't be one. I refer to the Writing Apache
Modules book by Stein/MacEachern.

The prob is quite simple: I have to redirect certain requests under
certain conditions to another URL (and please believe me: I tried with
mod_rewrite, this way seems to be more efficient). I'm using Apache
1.3.22 on Debian Linux 2.4.17.

These are the lines from my httpd.conf:

PerlFreshRestart On
PerlTaintCheck On
PerlSetEnv SHORTNAMES /etc/apache/shortnames.txt
PerlAddVar PROJECT_DOCUMENT_ROOT /home/disp05/app/fn/
PerlRequire /usr/local/sbin/appstart

Location /
   SetHandler perl-script
   PerlHandler Apache::StaticServer
/Location

The stanza in StaticServer.pm that fails is:

 if ($redirect = $shortnames-get($fname, WAIT, 1)) {
   if ($redirect !~ /$r-server()-server_hostname/) {
  $r-content_type('text/html');
  $r-header_out ( Location = $redirect ); $log-debug($redirect);
  return REDIRECT;
   }
 ...
 }

$shortnames is an Apache::SharedMem segment, containing a vast amount of
shortnames as keys and the corresponding URLs as values. The funny thing
is now, that although I do everything exactly as I find it in the book
on p.125 (content_type, header_out, REDIRECT), I get pure nonsense.

This is what a libwww-perl client displays when I try to access the address:
500 (Internal Server Error) unexpected EOF before status line seen
Client-Date: Wed, 06 Feb 2002 13:40:25 GMT

This is what I find in access_log:
192.168.255.75 - - [06/Feb/2002:14:46:24 +0100] GET /psycho HTTP/1.0
200 - - libwww-perl/5.50

And this is what stands in error_log:
[Wed Feb  6 14:46:24 2002] [debug]
/usr/local/share/perl/5.6.1/Apache/StaticServer.pm(45): [client
192.168.255.75] http://www.domain.de/app/fn/portal_welcome_jsp/52329.html

The error log proves that the second if() matches, as the entry comes
from my $log-debug(...).

Has anyone got an idea? I'm close to depression -;)

Many thanx in advance
Martin




Re: [QUESTION]PerlHandler and PerlLogHandler Phase

2002-02-01 Thread Thomas Klausner

Hi!

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

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


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



RE: [QUESTION]PerlHandler and PerlLogHandler Phase

2002-02-01 Thread Rob Bloodgood

 2.If the answer to the above question is YES? The
 Handler will add headers,footers for everything. What
 do I need to do to apply the handler logic just to the
 requested page and return the remaining files that are
 needed to complete the requested page as they are?

In the Eagle book (as well as a Perl Journal article) there is an example of
a Apache::Header/Apache::Footer.  CPAN doesn't show them right now.  But you
could implement them as filters using Apache::Filter to mark up each
document on its way out, based on URI.

 3. When I move these JS files outside the /en/course
 URI they seem to work? But now when I put them with
 in? It just displays the Javascript code like simple
 text on the browser.

SCRIPT SRC=/en/course/one.js/SCRIPT
... or you could template them in directly, since you're playing w/ the
content already.

 4. In the Logging Phase, I need to store the last
 requested page as a bookmark. So if the user logs out,
 and logs back in it takes him to the same page. Since
 the html files are made up of some many requests to
 other files, it stores the last file it requested. It
 may be path to an image file,style sheet file etc...
 Is there any way I can circumvent this problem?

You could use a cookie, issued with each document, noting what url they are
on right now??  Logging it (storing it) and then reading it back are bound
to be way too much work.

HTH!

L8r,
Rob




Re: [QUESTION]PerlHandler and PerlLogHandler Phase

2002-02-01 Thread Mod Perl

Thanks Thomas,
Question:
  Here are the problems/Questions that I face:
  1. Since in this case each requests for a html
 file has multiple files that need to be downloaded 
  the client. Am I right to assume that the handler
 will act on each and every file requested file 
 below my /en/course URI?
Answer:
 Add something like
 return DECLINED unless $r-content_type() eq
  'text/html';
 near the top of your handler.
 This way only html-documents get handled by your
 handler, the rest falls
 through to the default apache handler.

This one did work for most of the cases. Which is the
first war among many battles? I also have cases where
the book content has pop up windows to display meaning
of words that do not need the entire header to be
displayed .i.e. the handler should not be act on such
a request. 
Question:
Is there a way I can put them in a directory and when
the uri matches that directory, i disable the handler?
If so how can I do it?

Mark

__
Do You Yahoo!?
Great stuff seeking new owners in Yahoo! Auctions! 
http://auctions.yahoo.com



RE: [QUESTION]PerlHandler and PerlLogHandler Phase

2002-02-01 Thread Mod Perl

Thanks Rob for your reply.
--- Rob Bloodgood [EMAIL PROTECTED] wrote:
Question:
  2.If the answer to the above question is YES? The
  Handler will add headers,footers for everything.
 What do I need to do to apply the handler logic 
 justto the requested page and return the remaining 
 files that are needed to complete the requested 
 page as they are?
Answer:
 In the Eagle book (as well as a Perl Journal
 article) there is an example of a 
Apache::Header/Apache::Footer.  CPAN doesn't show
 them right now.  But you could implement them as 
filters using Apache::Filter to mark up each
 document on its way out, based on URI.
Reply:
I shall look into this.  There is some database
entries that have to take place as the web pages are
being servered. 
Question:
  3. When I move these JS files outside the
 /en/course URI they seem to work? But now when I 
 put them with in? It just displays the Javascript 
 code like simple text on the browser.
Answer:
 SCRIPT SRC=/en/course/one.js/SCRIPT
 ... or you could template them in directly, since
 you're playing w/ the content already.
Reply: Most of the books are already existing in that
format. To Change them would be a lot of code
rewriting,testing and deploying. 

Question:
  4. In the Logging Phase, I need to store the last
  requested page as a bookmark. So if the user logs
 out, and logs back in it takes him to the same
page.
 Since the html files are made up of some many 
 requests to other files, it stores the last file it
requested.
  It may be path to an image file,style sheet file
 etc... Is there any way I can circumvent this
problem?
Answer: 
 You could use a cookie, issued with each document,
 noting what url they are on right now??  Logging it
(storing it) and then  reading it back are bound
 to be way too much work.
Reply: I kind of figured this portion out. Though its
is not a clean way to do it. In the ActivityLogger.pm,
I plan to use $r-the_request instead of $r-uri. 

The PerlLogHandler being called on every request will
be overwriting the same data in the database.  Let us
assume that the web page request has 5 more files that
it depends. Would not the PerlLogHandler be called
when each file is being server.
 
 HTH!
 
 L8r,
 Rob
 


__
Do You Yahoo!?
Great stuff seeking new owners in Yahoo! Auctions! 
http://auctions.yahoo.com



Re: QUESTION: how to debug segfault apache1.3.22/mod_perl1.26/HTML::Mason

2002-01-21 Thread Ged Haywood

Hi there,

On Wed, 16 Jan 2002, Chris Hutchinson wrote:

 I've recently built apache 1.3.22/mod_perl 1.26, statically with perl 
 5.6.1 on linux RH 7.0.
 [snip]
 ccversion='', gccversion='2.96 2731 (Red Hat Linux 7.0)', 

At the risk of sounding like a broken record, have you tried compiling
everyhthing with a different compiler?  The one supplied with RH7.0
had some problem (I gather:).

On a couple of RH6.2 systems I'm still using 2.91.66 with no problems,
in fact I've deliberately avoided upgrading gcc because the docs said
it wouldn't compile my kernels any more if I did...

73,
Ged.




Re: question on installing mod_perl to activePerl on win98

2001-06-25 Thread Randy Kobes

On Mon, 25 Jun 2001, ychen56 wrote:

 Hi:
 From your website http://perl.apache.org/distributions.html, I got
 message( see following)

 Win32 ActivePerl mod_perl ppms - suitable for builds 6xx. You can install
 this by, within the ppm shell, setting the repository to
 http://theoryx5.uwinnipeg.ca/cgi-bin/ppmserver?urn:/PPMServer and typing
 install mod_perl. This will also run a post-install script to install the
 required mod_perl.so to your Apache modules/ directory.

 I followed the instruction, but ppm can not find mod_perl, in fact I opened
 this link, nothing there. I really need to install mod_perl in my computer
 to do some projects, my operation system is win98, I appreciate to get your
 quick respond.

 Thanks
 Ye

The above link only gives something sensible when called by
the ppm utility. Did you try this as

  DOS ppm
  ppm set repository whatever
http://theoryx5.uwinnipeg.ca/cgi-bin/ppmserver?urn:/PPMServer
  ppm search mod_perl
  ppm install mod_perl
  ppm quit
  DOS

(the set repository ... should appear on one line). If this
doesn't work, try installing directly as (again as one line)

  DOS ppm install
http://theoryx5.uwinnipeg.ca/ppmpackages/mod_perl.ppd

If neither of these work, do you have problems installing
modules from ActiveState's repository? eg, does

  DOS ppm install GD

install GD.pm OK?

best regards,
randy kobes




Re: question on installing mod_perl to activePerl on win98

2001-06-25 Thread ychen56

Thanks, I have installed mod_perl successfully by setting the repository to
http://theoryx5.uwinnipeg.ca/ppmpackages/.
I have one more question. The version of mod_perl is 1.25 which is written
for apache 1.3.20, my  apache version is 1.3.14,
I think I need copy the file mod_perl.so to apachemodperl.dll, right? What
else I need to do? Or I have to use apache 1.3.20 instead of 1.3.14?

Best Regards
Ye

- Original Message -
From: Randy Kobes [EMAIL PROTECTED]
To: ychen56 [EMAIL PROTECTED]
Cc: Mod Perl List [EMAIL PROTECTED]
Sent: Monday, June 25, 2001 4:35 PM
Subject: Re: question on installing mod_perl to activePerl on win98


 On Mon, 25 Jun 2001, ychen56 wrote:

  Hi:
  From your website http://perl.apache.org/distributions.html, I got
  message( see following)
 
  Win32 ActivePerl mod_perl ppms - suitable for builds 6xx. You can
install
  this by, within the ppm shell, setting the repository to
  http://theoryx5.uwinnipeg.ca/cgi-bin/ppmserver?urn:/PPMServer and typing
  install mod_perl. This will also run a post-install script to install
the
  required mod_perl.so to your Apache modules/ directory.
 
  I followed the instruction, but ppm can not find mod_perl, in fact I
opened
  this link, nothing there. I really need to install mod_perl in my
computer
  to do some projects, my operation system is win98, I appreciate to get
your
  quick respond.
 
  Thanks
  Ye

 The above link only gives something sensible when called by
 the ppm utility. Did you try this as

   DOS ppm
   ppm set repository whatever
 http://theoryx5.uwinnipeg.ca/cgi-bin/ppmserver?urn:/PPMServer
   ppm search mod_perl
   ppm install mod_perl
   ppm quit
   DOS

 (the set repository ... should appear on one line). If this
 doesn't work, try installing directly as (again as one line)

   DOS ppm install
 http://theoryx5.uwinnipeg.ca/ppmpackages/mod_perl.ppd

 If neither of these work, do you have problems installing
 modules from ActiveState's repository? eg, does

   DOS ppm install GD

 install GD.pm OK?

 best regards,
 randy kobes




NetZero Platinum
No Banner Ads and Unlimited Access
Sign Up Today - Only $9.95 per month!
http://www.netzero.net



Re: question on installing mod_perl to activePerl on win98

2001-06-25 Thread Randy Kobes

On Mon, 25 Jun 2001, ychen56 wrote:

 Thanks, I have installed mod_perl successfully by setting the repository to
 http://theoryx5.uwinnipeg.ca/ppmpackages/.
 I have one more question. The version of mod_perl is 1.25 which is written
 for apache 1.3.20, my  apache version is 1.3.14,
 I think I need copy the file mod_perl.so to apachemodperl.dll, right? What
 else I need to do? Or I have to use apache 1.3.20 instead of 1.3.14?

 Best Regards
 Ye

Generally, in the Win32 Apache world, one should keep as current
as possible, for bug/security fixes. So if it's at all possible,
it's probably a good idea to upgrade to Apache_1.3.20. If that's
impossible, there are older Apache/mod_perl versions in
  http://theoryx5.uwinnipeg.ca/ppmpackages/mod_perl-legacy/.
The versioning goes mod_perl-x.xx_y.yy.ppd, where x.xx refers
to the mod_perl version and y.yy refers to the apache version.
You should note the .ppd file corresponding to your apache
version, and install it as (all on one line)
ppm install
http://theoryx5.uwinnipeg.ca/ppmpackages/mod_perl-legacy/whatever.ppd
Using a mod_perl version compiled for a different apache than you're
using doesn't always work. Note that, after Apache_1.3.15, the name of
the mod_perl dll that goes into your Apache modules/ directory was
changed from ApacheModulePerl.dll to mod_perl.so.

best regards,
randy kobes




Re: Question and problem with graphics and Apache:ASP running.

2001-04-06 Thread Joshua Chamas

Steve Hurley wrote:
 
 When I turn on Apache:ASP and try to load a few html files it messes up the graphics 
at the top.
 
   Now if I turn off the ASP, graphics load fine...
   Page with banner graphics split up: http://www.clark.cc.oh.us/asp/student.html
   page with one banner graphic...: http://www.clark.cc.oh.us/asp/student2.html
 
   in http.conf:
   Location /asp/
   SetHandler perl-script
   PerlHandler Apache::ASP
   PerlSetVar Global /tmp
   /Location
 

If you want to mix media types in the same directory, use the 
Files Apache config to mark certain files for Apache::ASP execution
like so:

Files ~ (\.htm$)
SetHandler  perl-script
PerlHandler Apache::ASP
PerlSetVar  NoState 1
/Files

I'm guessing that Apache::ASP was trying to parse anything under
/asp/, including graphics, which just _might_ mess things up :)

-- Josh
_
Joshua Chamas   Chamas Enterprises Inc.
NodeWorks  free web link monitoring   Huntington Beach, CA  USA 
http://www.nodeworks.com1-714-625-4051



Re: Question

2000-11-22 Thread Matthew Byng-Maddick

On Wed, 22 Nov 2000, Jonathan Tweed wrote:
 I would be grateful if someone could answer this question:
 Even if you tell Apache only to execute files in a certain directory under
 mod_perl do all processes still include the mod_perl code?

If I understand your question correctly, yes.

MBM

-- 
Matthew Byng-Maddick   Home: [EMAIL PROTECTED]  +44 20  8981 8633  (Home)
http://colondot.net/   Work: [EMAIL PROTECTED] +44 7956 613942  (Mobile)
Diplomacy is the art of saying "nice doggie" until you can find a rock.
-- Wynn Catlin


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




RE: Question

2000-11-22 Thread Peiper,Richard


How could they not? Since the files are executable by any process,
then all processes must have the mod_perl code in it. You could if you
really wanted to run 2 versions of Apache, one with mod_perl and one
without. You could then call all CGI's through a different IP and then run
mod_perl on that one only. This would reduce the sizes of your executables
running in memory for Apache.

Richard
Web Engineer
ProAct Technologies Corp.


 -Original Message-
 From: Jonathan Tweed [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, November 22, 2000 9:15 AM
 To: '[EMAIL PROTECTED]'
 Subject: Question
 
 
 Hi
 
 I would be grateful if someone could answer this question:
 
 Even if you tell Apache only to execute files in a certain 
 directory under
 mod_perl do all processes still include the mod_perl code?
 
 Thanks
 
 Jonathan Tweed
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 



Re: Question

2000-11-22 Thread Les Mikesell

If you run the 2-apache model described in the guide (as you generally
need on a busy site), you can use the locations set in ProxyPass
directives to determine which requests are passed to the backend
mod_perl apache and let the lightweight front end handle the
others directly.   Or you can use mod_rewrite to almost arbitrarily
select which requests are run immediately by the front end or
proxied through to the back end server.  You don't have to make
it visible to the outside by running the back end on a different
address - it can be another port accessed only by the front end
proxy.

  Les Mikesell
 [EMAIL PROTECTED]

- Original Message -
From: "Peiper,Richard" [EMAIL PROTECTED]
To: "'Jonathan Tweed'" [EMAIL PROTECTED];
[EMAIL PROTECTED]
Sent: Wednesday, November 22, 2000 8:20 AM
Subject: RE: Question



 How could they not? Since the files are executable by any process,
 then all processes must have the mod_perl code in it. You could if you
 really wanted to run 2 versions of Apache, one with mod_perl and one
 without. You could then call all CGI's through a different IP and then run
 mod_perl on that one only. This would reduce the sizes of your executables
 running in memory for Apache.

 Richard
 Web Engineer
 ProAct Technologies Corp.


  -Original Message-
  From: Jonathan Tweed [mailto:[EMAIL PROTECTED]]
  Sent: Wednesday, November 22, 2000 9:15 AM
  To: '[EMAIL PROTECTED]'
  Subject: Question
 
 
  Hi
 
  I would be grateful if someone could answer this question:
 
  Even if you tell Apache only to execute files in a certain
  directory under
  mod_perl do all processes still include the mod_perl code?
 
  Thanks
 
  Jonathan Tweed



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




Re: question on DBIx::Recordset PrevNextForm

2000-11-13 Thread Gerald Richter

 Is there any way to hide the form data that the DBIx::Recordset
 PrevNextForm function generates?  i just noticed that if someone does a
 "view source," the user can view your db connection, username, password,
 etc.  That doesn't seem very secure even though this is a pretty cool
 subroutine to have.  I'm using embed perl to handle these request so
 perhaps there might be another mechanism that works with DBIx::Recordset
 that does the same thing without having to write that kind of sensitive
 information as hidden fields?  Thanks


Normaly there are no sensitive data in hidden fields. The hidden fields only
contain the data, you send to the page. That means when you request the page
with a link http://host/db.epl?username=foopassword=secret you will find
the username and the password in the hidden fields, but that's not the fault
of DBIx::Recordset. More exactly, DBIx::Recordset uses the values from
%fdat, so if you add your username and your password to %fdat, they will
also apear in the hidden fields. In this case either delete them from %fdat,
before you call PrevNextForm or better never put them in.

Gerald


-
Gerald Richterecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:   Tulpenstrasse 5 D-55276 Dienheim b. Mainz
E-Mail: [EMAIL PROTECTED] Voice:+49 6133 925151
WWW:http://www.ecos.de  Fax:  +49 6133 925152
-





Re: Question on Apache::Compress

2000-10-02 Thread Ben Cottrell

On Mon, 2 Oct 2000 15:28:09 -0400 (EDT), kevin montuori wrote:
   bc Static .html files aren't compressed at all (but do come through
   bc as text/html).
   
   do you have 
 
 SetHandler perl-script
 
   in there somewhere?

Kevin,

This fixes static html completely! It's compressed, and also comes
through as text/html. Thanks very much!!

perl scripts are still coming through as compressed (which is good)
text/plain (which is bad). Umm. Who has control over the content-type?
I thought the perl script itself did (i.e. print "Content-Type: text/html\n\n")
but I can't find that anywhere in our perl code (I'm not the one who writes
the scripts, so I don't know the code... I'm just responsible for apache).
Is there any other possible way the content type would have been getting
set, previously, that might be broken with the addition of Apache::Compress?

Thanks again :-)

~Ben



Re: PerlSendHeader Off socket persistence (was Re: question: usingApache for non-HTML messages)

2000-09-28 Thread Doug MacEachern

On Wed, 27 Sep 2000, B. Burke wrote:

 When I set PerlSendHeader to Off in my perl.conf it doesn't send headers,
 which
 is good.  The bad part is that it seems to break socket persistence for some
 reason.
 When I have PerlSendHeader set to On, I can open a socket with my test client,
 
 and make multiple queries on the same socket.

what is your test client?  apache will close the connection after the
first request, unless keep-alive is maintained between client/server.




Update: Re: PerlSendHeader Off socket persistence (was Re: question: usingApache for non-HTML messages)

2000-09-28 Thread B. Burke


 what is your test client?
I wrote a command line client that just sends/receives basic messages for testing.

I have been opening a socket and sending this:
GET /perl/myscript HTTP/1.1
Connection: Keep-Alive
Host: myhost.mydomain.com\n\n

It worked as expected - I was able to keep the socket open and send  receive
multiple
messages.  When I set PerlSendHeader to Off, the socket closed after the 1st query.

I finally had success with socket persistence when I tried using CGI to print the
header
by replacing this:
print "Content-type: text/html\n\n";
with this:
print header();

Once I changed how I was printing the header from the script, the socket
persistence
worked with PerlSendHeader Off.  So I guess I solved my problem although I don't
really
know why.

Brian


Doug MacEachern wrote:

 On Wed, 27 Sep 2000, B. Burke wrote:

  When I set PerlSendHeader to Off in my perl.conf it doesn't send headers,
  which
  is good.  The bad part is that it seems to break socket persistence for some
  reason.
  When I have PerlSendHeader set to On, I can open a socket with my test client,
 
  and make multiple queries on the same socket.

 what is your test client?  apache will close the connection after the
 first request, unless keep-alive is maintained between client/server.




PerlSendHeader Off socket persistence (was Re: question: using Apache for non-HTML messages)

2000-09-27 Thread B. Burke

When I set PerlSendHeader to Off in my perl.conf it doesn't send headers,
which
is good.  The bad part is that it seems to break socket persistence for some
reason.
When I have PerlSendHeader set to On, I can open a socket with my test client,

and make multiple queries on the same socket.

Any ideas to help me keep the socket open?

Thanks,
Brian

Doug MacEachern wrote:

 On Mon, 25 Sep 2000, B. Burke wrote:

  I've been able to basically remove the response headers by removing the
  functionality
  of ap_sen_header_field() before compiling Apache, but it would be nice to

 you don't have to remove anything, just don't call $r-send_http_header
 and make sure PerlSendHeader is configured to Off, then Apache will not
 send any headers.




Re: question: using Apache for non-HTML messages

2000-09-26 Thread Doug MacEachern

On Mon, 25 Sep 2000, B. Burke wrote:
 
 I've been able to basically remove the response headers by removing the
 functionality
 of ap_sen_header_field() before compiling Apache, but it would be nice to

you don't have to remove anything, just don't call $r-send_http_header
and make sure PerlSendHeader is configured to Off, then Apache will not
send any headers.




Re: question: using Apache for non-HTML messages

2000-09-25 Thread David Alan Pisoni

Really all you need to do is send your response back like you would any response, just 
without the HTML formatting.  If you wanted to be a bit more "correct", you could 
change the content-type of the respose so that it is not 'text/html'.  (In your case, 
you might just make one up like 'application/x-brians-spiffy-protocol' or whatever you 
think is appropriate preceded with 'x-'.)  Or, if you wanted to debug it using a web 
browser, you could simply use 'text/plain', and your browser will display the raw 
result.

It is important to note that Apache is an HTTP server, not an "HTML server".  It is 
capable of serving any sort of serial content.

So anyway, since it looks like you're using a registry script, you would merely start 
your output with :
print "Content-type: " . $my_content_type . "\n\n"; # note the 2 newlines!

and then proceed directly to your proprietary output.

Make sense?

David

At 9.21 -0400 9/25/2000, B. Burke wrote:
Here is an example of what I'm looking to do.

GET /perl/app.pl?MODE=searchCITY=DallasSTATE=TXID=195302 HTTP/1.0
Accept: text/html
User-Agent:  MyTestClient1.0
From:  nowhere.com

I want to replace the HTML request above with something like this:

|MODE=search|CITY=Dallas|STATE=TX|ID=195302|

I can hard code the handler to do GET's against only one script.  The request
format
is VERY similiar to the arguments in a GET (all I really have to do is
translate the pipe).
I think for the response, all I need to do is remove the headers entirely,
and I can format
the script output to conform to our API (I don't need protocol headers for
requests nor
for responses).

I've been able to basically remove the response headers by removing the
functionality
of ap_sen_header_field() before compiling Apache, but it would be nice to
have a
more eloquent solution through mod_perl.

Thanks,
Brian


Matt Sergeant wrote:

 On Mon, 25 Sep 2000, B. Burke wrote:

 
  I'm using Apache/1.3.11 with mod_perl/1.22 on an AIX platform to serve
  as an application server, with persistent ties into a MySQL database.
 
  My company is using an in-house socket API for data transfers.  The
  request messages in our API are somewhat similiar to an HTML GET
  request, in that we use tagged, delimited fields (pipe delimited
  instead of  delimited).
 
  I have written a socket server gateway to act as a protocol converter,
  to convert our API's requests into HTML GET's (and also convert the
  HTML output into our API's response format).
 
  My question is this.  Is it possible using mod_perl for me to
  incorporate the protocol conversion into Apache itself?  In other
  words, can I strip out the need for HTML headers, and rewrite the
  format of GET requests to comply with our proprietary API? I don't
  know if this is something that I can do through mod_perl, or if I will
  have to dig deeper into C and recompile a new server.
 
  Any help or ideas will be mucho appreciated!

 I don't think you'll actually have to re-write anything. Although an
 example of a transaction would be most helpful. All you have to do is
 setup mod_perl to handle the connection, Apache _should_ be able to handle
 the request if it looks enough like a GET request, and you should be able
 to respond to it with little enough information, provided your responses
 are also similar to HTTP responses (HTTP response code followed optionally
 by headers then the body).

 --
 Matt/

 Fastnet Software Ltd. High Performance Web Specialists
 Providing mod_perl, XML, Sybase and Oracle solutions
 Email for training and consultancy availability.
 http://sergeant.org | AxKit: http://axkit.org




Re: Question

2000-09-17 Thread Yann Kerhervé

On Tue, Sep 12, 2000 at 04:34:28PM +0100, David Hodgkinson wrote:
 "Eric Cholet" [EMAIL PROTECTED] writes:
 
  well then we're a long shot away, and so are many French natives :)
  Nah, we won't be that demanding, lest we scare him away from the,
  erm, "most  beautiful city in the world".
 
 What? Bath?
 
 Dave // Found communication in Paris much improved with a thick,
  \\ Inspector Clouseau accent...izzat yeur Minkey?

Inspector Clouseau ? what's that ?
Another french hero that tv-producer is hidding from us, here, in France
?



Re: Question

2000-09-12 Thread David Hodgkinson

"Eric Cholet" [EMAIL PROTECTED] writes:

 well then we're a long shot away, and so are many French natives :)
 Nah, we won't be that demanding, lest we scare him away from the,
 erm, "most  beautiful city in the world".

What? Bath?

Dave // Found communication in Paris much improved with a thick,
 \\ Inspector Clouseau accent...izzat yeur Minkey?



Re: Question

2000-09-11 Thread Matt Sergeant

On 11 Sep 2000 [EMAIL PROTECTED] wrote:

 
 Anyone know why a browser would send something like this?
 
 HTTP_ACCEPT_LANGUAGE=en-us,x-ns1MKtfdqbuNhQ;q=0.4,x-ns2r2e09OnmPe2
 
 the x-ns1 and x-ns2 stuff look like base64 encoded 8-byte blocks, almost as if
 it's some kind of key exchange or key leaking mechanism.

Its very odd that one specifies a score too. I've never seen this before.

-- 
Matt/

Fastnet Software Ltd. High Performance Web Specialists
Providing mod_perl, XML, Sybase and Oracle solutions
Email for training and consultancy availability.
http://sergeant.org | AxKit: http://axkit.org




Re: Question

2000-09-11 Thread Stas Bekman

On Mon, 11 Sep 2000, Matt Sergeant wrote:

 On 11 Sep 2000 [EMAIL PROTECTED] wrote:
 
  
  Anyone know why a browser would send something like this?
  
  HTTP_ACCEPT_LANGUAGE=en-us,x-ns1MKtfdqbuNhQ;q=0.4,x-ns2r2e09OnmPe2
  
  the x-ns1 and x-ns2 stuff look like base64 encoded 8-byte blocks, almost as if
  it's some kind of key exchange or key leaking mechanism.
 
 Its very odd that one specifies a score too. I've never seen this before.

The score is a part of the RFC. You forget that the browser is not only NC
or IE :)  You can implement your own browser in many ways and than send
any kind of headers. So if I send to your server this header:

HTTP_ACCEPT_LANGUAGE=Stas_is_learning_french_please_speak_slowly;q=0.99,en-us;0.01

Will you also ask why Stas is learning french? :) :) :) I ask myself the
same question :)

_
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://perlmonth.com   perl.org   apache.org





Re: Question

2000-09-11 Thread Matt Sergeant

On Mon, 11 Sep 2000, Stas Bekman wrote:

 On Mon, 11 Sep 2000, Matt Sergeant wrote:
 
  On 11 Sep 2000 [EMAIL PROTECTED] wrote:
  
   
   Anyone know why a browser would send something like this?
   
   HTTP_ACCEPT_LANGUAGE=en-us,x-ns1MKtfdqbuNhQ;q=0.4,x-ns2r2e09OnmPe2
   
   the x-ns1 and x-ns2 stuff look like base64 encoded 8-byte blocks, almost as if
   it's some kind of key exchange or key leaking mechanism.
  
  Its very odd that one specifies a score too. I've never seen this before.
 
 The score is a part of the RFC. You forget that the browser is not only NC
 or IE :)  You can implement your own browser in many ways and than send
 any kind of headers. So if I send to your server this header:

Yes I know the RFC well :-)

 HTTP_ACCEPT_LANGUAGE=Stas_is_learning_french_please_speak_slowly;q=0.99,en-us;0.01

But to what purpose? That was the point. No server is going to deliver
alternate content in a language that isn't defined by the IANA list.

 Will you also ask why Stas is learning french? :) :) :) I ask myself the
 same question :)

:-)

-- 
Matt/

Fastnet Software Ltd. High Performance Web Specialists
Providing mod_perl, XML, Sybase and Oracle solutions
Email for training and consultancy availability.
http://sergeant.org | AxKit: http://axkit.org




Re: Question

2000-09-11 Thread G.W. Haywood

HI Stas,

On Mon, 11 Sep 2000, Stas Bekman wrote:

 Will you also ask why Stas is learning French?

Chercher la femme?
 [50 Jahre Musik mit Hazy Osterwald]

73,
Ged.





Re: Question

2000-09-11 Thread Vivek Khera

 "GWH" == G W Haywood [EMAIL PROTECTED] writes:

GWH HI Stas,
GWH On Mon, 11 Sep 2000, Stas Bekman wrote:

 Will you also ask why Stas is learning French?

GWH Chercher la femme?

Most likely because the people in Paris demand you speak to them in
perfect French.  High school level French is not accepted ;-|


-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Vivek Khera, Ph.D.Khera Communications, Inc.
Internet: [EMAIL PROTECTED]   Rockville, MD   +1-301-545-6996
GPG  MIME spoken herehttp://www.khera.org/~vivek/



Re: Question

2000-09-11 Thread Eric Cholet

 GWH HI Stas,
 GWH On Mon, 11 Sep 2000, Stas Bekman wrote:
 
  Will you also ask why Stas is learning French?
 
 GWH Chercher la femme?
 
 Most likely because the people in Paris demand you speak to them in
 perfect French.  High school level French is not accepted ;-|

well then we're a long shot away, and so are many French natives :)
Nah, we won't be that demanding, lest we scare him away from the,
erm, "most  beautiful city in the world".

--
Eric





Re: Question about suggested AIX patch to perl.

2000-09-02 Thread Jens-Uwe Mager

On Fri, Sep 01, 2000 at 07:45:46PM -0400, Paul J. Reder wrote:
 I am working to update my instructions for getting mod_perl working as a DSO
 on AIX. I see that there is a recommended patch for dl_aix.xs to get XS 
 working.
 
 I am currently testing on AIX 4.3.3, Apache 1.3.13-dev, and IBM's IHS version
 1.3.12.2. There does not seem to be a perl file named dl_aix.xs anywhere in
 the perl tree (perl5.00503 - which I believe is the default that is shipped
 with AIX now). I did a find on the machine and found nothing. There isn't even
 a perl subdirectory named ext.
 
 Mod_perl seems to be working ok with the tests I have run. Do you know what
 versions of perl/AIX require this patch? Do you know of a definitive test
 to see if I am broken or not? I looked through the newsgroups and archives
 that I could find and found no definitive answer as to what the patch applies
 to.

I would believe if you are talking about the binary perl distribution
that is shipped with AIX 4.3.3 nowadays, for that one you would not find
dl_aix.xs as the perl package does not include the source it is built
from. The patch is for those folks that build their perl from sources,
e.g. by downloading the .tar.gz file from CPAN.

To find out if you have the problem you will need to use a perl XS
module that also needs to reference symbols from the Apache core, for
example HTML::Embperl or libapreq. These modules will dump core
without the patch.

-- 
Jens-Uwe Mager

HELIOS Software GmbH
Steinriede 3
30827 Garbsen
Germany

Phone:  +49 5131 709320
FAX:+49 5131 709325
Internet:   [EMAIL PROTECTED]



Re: question on code snippet in mod_perl guide

2000-09-01 Thread Stas Bekman

On Thu, 31 Aug 2000, Aaron Johnson wrote:

 I don't work on Oracle so I will speak from my experience with MySQL.  MySQL
 servers time out after the 8 hour standard disconnect for inactivity (this
 can be adjusted in your my.conf file).  To compensate for this we now run our
 own connect checks for a valid dbh handle before it goes it all the trouble
 to make one along with Apache::DBI

In fact there is no need for a ping, I don't see why don't you just make
the timeout long enough so it'd never time out. I use 48 hours:
http://perl.apache.org/guide/databases.html#The_Morning_Bug


 We have not had any more issues with the database connects since we moved to
 this method.  We do a ping and validate the dbh handle rather then blindly
 accessing the dbh handle since Apache::DBI will only validate the dbh handle
 on a connect.
 
 Aaron Johnson
 
 Perrin Harkins wrote:
 
  On Thu, 31 Aug 2000 [EMAIL PROTECTED] wrote:
   What I think is going on is that the script gets killed by Oracle for
   being idle and tries to ping the connection, but the ping fails.
 
  It is supposed to reconnect when the ping fails.  I've had problems
  getting reconnects to Oracle 8 working.  The "solution" we ended up with
  was to make processes that can't reconnect send an error page and
  exit.  New processes are able to connect.  I'm not sure what causes this
  problem.
 
  Since your problem is caused by your processes being idle for too long,
  this may go away when you move out of testing mode into a public release.
  You might want to tweak your MinSpareServers settings so that you won't
  have lots of idle processes hanging around.
 
   Rebild your mod_perl with the EVERYTHING=1 flag.  That will get rid
   of the above error message.
  
   So I have to re-install it?  Is there anything I need to do when I
   rebuild it?  Or do I just need to reinstall mod_perl as it's done in
   the documentation?
 
  Just rebuild it and re-install as it shows in the docs.
 
  - Perrin
 
 



_
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://perlmonth.com   perl.org   apache.org





Re: question on code snippet in mod_perl guide

2000-08-31 Thread conark


Hmmm.  How busy is the site or is still in testing phase?

Testing phase.

Are you saying your connection is getting dropped and then you get an
error,or that you get dropped and then it has to reconnect?

Here's a sample of errors that I'm getting the error_log file:

[Tue Aug 29 20:15:52 2000] null: DBD::Oracle::st execute failed:
ORA-01012: not logged on (DBD ERROR: OCIStmtExecute) at
/u1/web/modules/(some_dir)/process.pm line 580.

[Tue Aug 29 20:25:21 2000] null: DBD::Oracle::db ping failed: ORA-02396:
exceeded maximum idle time, please connect again (DBD ERROR:
OCIStmtExecute/Describe) at /usr/lib/perl5/site_perl/5.005/Apache/DBI.pm
line 112.

What I think is going on is that the script gets killed by Oracle for
being idle and tries to ping the connection, but the ping fails.  I took
the suggestion in Apache::DBI and replaced the ping code with the
subroutine in Oracle.pm but we still encountered this issue.  Later on
though we want the connection back but it never makes another call to the
connect subroutine that is described in the performance tuning t docs.  I
was guessing that the .pm file that calls the connect routine is in memory
someplace so it has no need to call back connect since it assumes that the
connection is still present.  Then at some random interval we get that
error message from apache.  I'm out of ideas of what's causing this.


I guess I am missing the key to the question here :^)

I have some suggestions that can help, but I need to know which you are
dealing with first.

Cool.  Any help is much appreciated :)

Rebild your mod_perl with the EVERYTHING=1 flag.  That will get rid of
the
above error message.

So I have to re-install it?  Is there anything I need to do when I rebuild
it?  Or do I just need to reinstall mod_perl as it's done in the
documentation?




--

Why is College Club the largest and fastest growing college student site?
Find out for yourself at http://www.collegeclub.com





Re: question on code snippet in mod_perl guide

2000-08-31 Thread Perrin Harkins

On Thu, 31 Aug 2000 [EMAIL PROTECTED] wrote:
 What I think is going on is that the script gets killed by Oracle for
 being idle and tries to ping the connection, but the ping fails.

It is supposed to reconnect when the ping fails.  I've had problems
getting reconnects to Oracle 8 working.  The "solution" we ended up with
was to make processes that can't reconnect send an error page and
exit.  New processes are able to connect.  I'm not sure what causes this
problem.

Since your problem is caused by your processes being idle for too long,
this may go away when you move out of testing mode into a public release.  
You might want to tweak your MinSpareServers settings so that you won't
have lots of idle processes hanging around.

 Rebild your mod_perl with the EVERYTHING=1 flag.  That will get rid
 of the above error message.
 
 So I have to re-install it?  Is there anything I need to do when I
 rebuild it?  Or do I just need to reinstall mod_perl as it's done in
 the documentation?

Just rebuild it and re-install as it shows in the docs.

- Perrin




Re: question on code snippet in mod_perl guide

2000-08-31 Thread Aaron Johnson

I don't work on Oracle so I will speak from my experience with MySQL.  MySQL
servers time out after the 8 hour standard disconnect for inactivity (this
can be adjusted in your my.conf file).  To compensate for this we now run our
own connect checks for a valid dbh handle before it goes it all the trouble
to make one along with Apache::DBI

We have not had any more issues with the database connects since we moved to
this method.  We do a ping and validate the dbh handle rather then blindly
accessing the dbh handle since Apache::DBI will only validate the dbh handle
on a connect.

Aaron Johnson

Perrin Harkins wrote:

 On Thu, 31 Aug 2000 [EMAIL PROTECTED] wrote:
  What I think is going on is that the script gets killed by Oracle for
  being idle and tries to ping the connection, but the ping fails.

 It is supposed to reconnect when the ping fails.  I've had problems
 getting reconnects to Oracle 8 working.  The "solution" we ended up with
 was to make processes that can't reconnect send an error page and
 exit.  New processes are able to connect.  I'm not sure what causes this
 problem.

 Since your problem is caused by your processes being idle for too long,
 this may go away when you move out of testing mode into a public release.
 You might want to tweak your MinSpareServers settings so that you won't
 have lots of idle processes hanging around.

  Rebild your mod_perl with the EVERYTHING=1 flag.  That will get rid
  of the above error message.
 
  So I have to re-install it?  Is there anything I need to do when I
  rebuild it?  Or do I just need to reinstall mod_perl as it's done in
  the documentation?

 Just rebuild it and re-install as it shows in the docs.

 - Perrin




Re: Question about Apache::DBI::DEBUG

2000-08-30 Thread Yann Neuhaus

Hi

Sorry I don't really remember the mail, I think it was because of the
DEBUG information that were missing in the Apache error_log.

There were many reasons why my Apache wasn't working with Apache::DBI
(not well compiled with mod_perl, http.conf not correctly set, .)

I wrote a little Article that will be publiched in the Swiss Oracle User
Group. It explains how to install all the features and contains a little
troubleshouting part. This sums up exactly what I did to use the
persistent connections with Apache::DBI.

Regards
Yann Neuhaus
Oracle Consultant
Trivadis AG

Krzysiek wrote:

 Hi
 I have seen your post on the perl_mod mailing list.
 I've got the same problem, How did you manage to solve it?

 Thank you in advance for your reply.

 Chris, Poland

 Oracle_apache_perl.zip


Re: Question about $sth-finish;

2000-08-17 Thread Tim Bunce

On Tue, Aug 15, 2000 at 03:26:03PM +0400, Vladislav Safronov wrote:
 Hi,
 
 Could you have a look at the lines and answer the question ..
 ---
 sub foo {
   my $dbh = shift;
 
   my $sql = ...
 
   my $sth = $dbh-prepare($sql);
   $sth-execute;
   $sth-finish;
 }
 ===
 Do I always need to call $sth-finish?

You *never* need to call finish on non-select statements.
(If you do, it's a driver bug.)

 Wouldn't it be automaticly called when
 sub foo ends (when my variable $sth get destroyed)?

Finish marks the end of *fetching*, not the end of life of the handle.

Reread the DBI 1.14 docs on finish and tell me if anything is unclear.

Tim.

p.s. If someone asked me what I'd change about the DBI I was to rewrite
it, I'd probably just say "rename finish to cancel_select".



Re: Question about $sth-finish;

2000-08-17 Thread Tim Bunce

On Tue, Aug 15, 2000 at 12:22:46PM -0500, Jay Jacobs wrote:
 
 
 On Tue, 15 Aug 2000, Tom Mornini wrote:
 
  It is my understanding of the DBI docs that you only need to call
  $sth-finish when you DON'T fetch all the rows that the $sth has ready to
  return.
  
 
 From "Writing Apache Modules with Perl and C":
   "You should still call finish() at the end of each series of fetches,
 even though you are going to reuse the statement handler.  Failure to do
 so can lead to memory leaks."

Not true. Unless there's a driver bug, in which case anything can happen.

 If I remember correctly, it also frees up any resources used by the
 database (depending on db) for the query, like for sorting, joining,
 etc.  But I can't quote a source for that one.

Me. But it's only relevant if you're _not_ fetching _all_ rows.

 From my point of view, it never hurts to call finish()...

True.

Tim.



Re: Question about $sth-finish;

2000-08-17 Thread Tim Bunce

On Wed, Aug 16, 2000 at 08:26:09AM +0200, Henrik Tougaard wrote:
 From: Jay Jacobs [mailto:[EMAIL PROTECTED]]
  On Tue, 15 Aug 2000, Tom Mornini wrote:
  
   It is my understanding of the DBI docs that you only need to call
   $sth-finish when you DON'T fetch all the rows that the 
  $sth has ready to
   return.
   
  
  From "Writing Apache Modules with Perl and C":
"You should still call finish() at the end of each series 
  of fetches,
  even though you are going to reuse the statement handler.  
  Failure to do
  so can lead to memory leaks."
  
 
 You picked the wrong authority for this! The right place (tm) to look 
 when discussing DBI is 'perldoc DBI'. The relevant quote is:

  If I remember correctly, it also frees up any resources used by the
  database (depending on db) for the query, like for sorting, joining,
  etc.  But I can't quote a source for that one.

 There is no authoritative source for that fallacy - I hope!

The right place (tm) to look when discussing DBI is 'perldoc DBI'. The
relevant quote is:

 $rc  = $sth-finish;
   
   [...]
   
   Consider a query like:
   
 SELECT foo FROM table WHERE bar=? ORDER BY foo
   
   where you want to select just the first (smallest) "foo" value from a
   very large table. When executed, the database server will have to use
   temporary buffer space to store the sorted rows. If, after executing
   the handle and selecting one row, the handle won't be re-executed for
   some time and won't be destroyed, the Cfinish method can be used to tell
   the server that the buffer space can be freed.

:-)

Tim.



RE: Question about $sth-finish;

2000-08-17 Thread Vladislav Safronov

 On Tue, Aug 15, 2000 at 03:26:03PM +0400, Vladislav Safronov wrote:
  Hi,
  
  Could you have a look at the lines and answer the question ..
  ---
  sub foo {
  my $dbh = shift;
  
  my $sql = ...
  
  my $sth = $dbh-prepare($sql);
  $sth-execute;
  $sth-finish;
  }
  ===
  Do I always need to call $sth-finish?
 
 You *never* need to call finish on non-select statements.
 (If you do, it's a driver bug.)
 
  Wouldn't it be automaticly called when
  sub foo ends (when my variable $sth get destroyed)?
 
 Finish marks the end of *fetching*, not the end of life of the handle.

So I can freely overwrite the handle with new one, since it's not the end
of life of the handle, can't I?
==
my $sql = "select .."
 
my $sth = $dbh-prepare($sql);
$sth-execute;
.. fetch just some (not all) data
my $newsql = "select .."
$sth = $dbh-prepare($newsql);
$sth-execute;
==
and this code should work with troubles ...

Vlad.



RE: Question about $sth-finish;

2000-08-16 Thread Henrik Tougaard

From: Jay Jacobs [mailto:[EMAIL PROTECTED]]
 On Tue, 15 Aug 2000, Tom Mornini wrote:
 
  It is my understanding of the DBI docs that you only need to call
  $sth-finish when you DON'T fetch all the rows that the 
 $sth has ready to
  return.
  
 
 From "Writing Apache Modules with Perl and C":
   "You should still call finish() at the end of each series 
 of fetches,
 even though you are going to reuse the statement handler.  
 Failure to do
 so can lead to memory leaks."
 

You picked the wrong authority for this! The right place (tm) to look 
when discussing DBI is 'perldoc DBI'. The relevant quote is:

  finish
$rc  = $sth-finish;

  Indicates that no more data will be fetched from this statement handle
  before it is either executed again or destroyed.  It is rarely needed
  but can sometimes be helpful in very specific situations in order to
  allow the server to free up resources currently being held (such as
  sort buffers).

  When all the data has been fetched from a select statement the driver
  should automatically call finish for you. So you should not normally
  need to call it explicitly.

Note the last sentence!


 If I remember correctly, it also frees up any resources used by the
 database (depending on db) for the query, like for sorting, joining,
 etc.  But I can't quote a source for that one.
There is no authoritative source for that fallacy - I hope!

 From my point of view, it never hurts to call finish()...
Quite true. Do you also undef all your variables just before they go
out of scope? Thats comparable. There are a *few* situations where finish
is needed (Michael Peppler has shown one, the DBI docs list another) but
must DBI programmers won't need finish ever.

Henrik



RE: Question about $sth-finish;

2000-08-16 Thread Henrik Tougaard

 From: Vladislav Safronov [mailto:[EMAIL PROTECTED]]

 What can you say about this code? is it ok (overwriting 
 previous handle)?
 
 ==
 sub foo {
   my $dbh = shift;
 
   my $sql1 = "select *...
   my $sql2 = "select *...
 
   my $sth = $dbh-prepare($sql1);
   $sth-execute;
   .. fetch some data.
 
   # should be $sth-finish inserted??
 
   $sth = $dbh-prepare($sql2); # we overwrite previous 
 handle saved in $sth
 ..
   $sth-execute;
   .. fetch some data.
   return;
 }
 ==

$sth-finish should be inserted if (and ONLY if) the C...fetch some data
does NOT fetch ALL data in the select. If you do some thing like:
   while (my $r=$sth-fetchrow_arrayref) {
 .. handle data;
   }
there is no reason to call finish, but if you do
   while (...$sth-fetch..) {
   
   last if some condition;
   }
you will have to call finish, but I would reccomend using
another name for the second statement (that would help
the poor sod who will try to understand this in a years time :)

Henrik



RE: Question about $sth-finish;

2000-08-16 Thread Vladislav Safronov

Well, summarizing all the answers and assuming using Mysql

1. $sth-finish should be used if (and ONLY if) the 
   the returned data (any SELECT, but not INSERT, UPDATE?)
   has not been fetched ALL and $sth is going to be
   overwritten..

2. $sth (defined as 'my') should not call finish before it
   gets out of scope..

Vlad/
   




RE: Question about $sth-finish;

2000-08-15 Thread Kenneth Lee

as written in the manpage, this is rarely used, it will be called for you
when the handle is going out of scope, but if something is still left in the
buffer some warnings will be generated.


-Original Message-
From: Vladislav Safronov
To: [EMAIL PROTECTED]
Sent: 8/15/00 7:26 PM
Subject: Question about $sth-finish;

Hi,

Could you have a look at the lines and answer the question ..
---
sub foo {
my $dbh = shift;

my $sql = ...

my $sth = $dbh-prepare($sql);
$sth-execute;
$sth-finish;
}
===
Do I always need to call $sth-finish? Wouldn't it be automaticly called
when
sub foo ends (when my variable $sth get destroyed)?

Vlad.



Re: Question about $sth-finish;

2000-08-15 Thread Matt Sergeant

On Tue, 15 Aug 2000, Vladislav Safronov wrote:

 Hi,
 
 Could you have a look at the lines and answer the question ..
 ---
 sub foo {
   my $dbh = shift;
 
   my $sql = ...
 
   my $sth = $dbh-prepare($sql);
   $sth-execute;
   $sth-finish;
 }
 ===
 Do I always need to call $sth-finish? Wouldn't it be automaticly called
 when
 sub foo ends (when my variable $sth get destroyed)?

$sth doesn't always get destroyed when foo ends (due to a bug in all
perls). But otherwise, yes.

-- 
Matt/

Fastnet Software Ltd. High Performance Web Specialists
Providing mod_perl, XML, Sybase and Oracle solutions
Email for training and consultancy availability.
http://sergeant.org | AxKit: http://axkit.org




RE: Question about $sth-finish;

2000-08-15 Thread Henrik Tougaard

From: Vladislav Safronov [mailto:[EMAIL PROTECTED]]
 sub foo {
   my $dbh = shift;
 
   my $sql = ...
 
   my $sth = $dbh-prepare($sql);
   $sth-execute;
   $sth-finish;
 }
 ===
 Do I always need to call $sth-finish? Wouldn't it be 
 automaticly called when
 sub foo ends (when my variable $sth get destroyed)?

You do *NOT* need to call $sth-finish - never, never, never.
[OK. not quite true: you need to call $sth-finish when you end a
 select statement before reading the last data in the cursor and
 want to reexecute the select statement. So the answer is:
  NEVER!!!]

If you worry about the statement handle still being defined I
would reccomend using  Cundef $sth instead. That will
certainly release all resources owned by the statement.
$sth-finish is just for very special cases - and this is
not one of them.

--
Henrik Tougaard, [EMAIL PROTECTED]



RE: Question about $sth-finish;

2000-08-15 Thread Vladislav Safronov

 On Tue, 15 Aug 2000, Vladislav Safronov wrote:
 
  Hi,
  
  Could you have a look at the lines and answer the question ..
  ---
  sub foo {
  my $dbh = shift;
  
  my $sql = ...
  
  my $sth = $dbh-prepare($sql);
  $sth-execute;
  $sth-finish;
  }
  ===
  Do I always need to call $sth-finish? Wouldn't it be 
 automaticly called
  when
  sub foo ends (when my variable $sth get destroyed)?
 
 $sth doesn't always get destroyed when foo ends (due to a bug in all
 perls). But otherwise, yes.

"my" (perl's my) variables doesn't always get destoyed, does it Perl's 
documentation say that "my" vars are the most safe since they get destroyed
when they get out of scope ...

Vlad.



RE: Question about $sth-finish;

2000-08-15 Thread Matt Sergeant

On Tue, 15 Aug 2000, Vladislav Safronov wrote:

 "my" (perl's my) variables doesn't always get destoyed, does it Perl's 
 documentation say that "my" vars are the most safe since they get destroyed
 when they get out of scope ...

I said this was a bug in Perl, although I don't think that 5.6.1 is fixing
it (due out "soon"), because its quite hard to track down. It occurs in
conditionals:

if (my $rec = foo()) {
# lexicals in foo() not destroyed here
}
# lexicals in foo() destroyed here.

This can be demonstrated with a very simple object class with a DESTROY
method. There's a message somewhere in the p5p archives about this from
me.

(and I don't mean the lexicals that might get returned and assigned to
$rec, for anyone assuming I don't know what I'm talking about)...

-- 
Matt/

Fastnet Software Ltd. High Performance Web Specialists
Providing mod_perl, XML, Sybase and Oracle solutions
Email for training and consultancy availability.
http://sergeant.org | AxKit: http://axkit.org




RE: Question about $sth-finish;

2000-08-15 Thread David Mitchell

Matt Sergeant [EMAIL PROTECTED] wrote:

 This can be demonstrated with a very simple object class with a DESTROY
 method. There's a message somewhere in the p5p archives about this from
 me.

That's

http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2000-03/msg00604.html

to save anyone else having to look :-)




RE: Question about $sth-finish;

2000-08-15 Thread Vladislav Safronov

Ok. I think, the answers clear the problem, but I have yet more question.

What can you say about this code? is it ok (overwriting previous handle)?

==
sub foo {
my $dbh = shift;

my $sql1 = "select *...
my $sql2 = "select *...

my $sth = $dbh-prepare($sql1);
$sth-execute;
.. fetch some data.

# should be $sth-finish inserted??

$sth = $dbh-prepare($sql2); # we overwrite previous handle saved in $sth
..
$sth-execute;
.. fetch some data.
return;
}
==

Vlad.




RE: Question about $sth-finish;

2000-08-15 Thread Matt Sergeant

On Tue, 15 Aug 2000, Vladislav Safronov wrote:

 Ok. I think, the answers clear the problem, but I have yet more question.
 
 What can you say about this code? is it ok (overwriting previous handle)?

[snip]

Well it depends on the DBMS. For example Sybase might not like it if you
haven't read everything from the $sth first - it will bite you in the bum
with locks. Others will be fine. So just be careful...

-- 
Matt/

Fastnet Software Ltd. High Performance Web Specialists
Providing mod_perl, XML, Sybase and Oracle solutions
Email for training and consultancy availability.
http://sergeant.org | AxKit: http://axkit.org




Re: Question about $sth-finish;

2000-08-15 Thread Keith G. Murphy

Matt Sergeant wrote:
 
 On Tue, 15 Aug 2000, Vladislav Safronov wrote:
 
  Hi,
 
  Could you have a look at the lines and answer the question ..
  ---
  sub foo {
my $dbh = shift;
 
my $sql = ...
 
my $sth = $dbh-prepare($sql);
$sth-execute;
$sth-finish;
  }
  ===
  Do I always need to call $sth-finish? Wouldn't it be automaticly called
  when
  sub foo ends (when my variable $sth get destroyed)?
 
 $sth doesn't always get destroyed when foo ends (due to a bug in all
 perls).

(Boggle)  Really? 'My' variables going out of scope don't always get
freed up?  Or is this strictly an object thing with DESTROY?



Re: Question about $sth-finish;

2000-08-15 Thread Matt Sergeant

On Tue, 15 Aug 2000, Keith G. Murphy wrote:

 (Boggle)  Really? 'My' variables going out of scope don't always get
 freed up?  Or is this strictly an object thing with DESTROY?

Well why would you care if my $str = "hello world" didn't get freed via
this bug? It only matters for objects that do something in DESTROY...

-- 
Matt/

Fastnet Software Ltd. High Performance Web Specialists
Providing mod_perl, XML, Sybase and Oracle solutions
Email for training and consultancy availability.
http://sergeant.org | AxKit: http://axkit.org




RE: Question about $sth-finish;

2000-08-15 Thread Michael Peppler

Matt Sergeant writes:
  On Tue, 15 Aug 2000, Vladislav Safronov wrote:
  
   Ok. I think, the answers clear the problem, but I have yet more question.
   
   What can you say about this code? is it ok (overwriting previous handle)?
  
  [snip]
  
  Well it depends on the DBMS. For example Sybase might not like it if you
  haven't read everything from the $sth first - it will bite you in the bum
  with locks. Others will be fine. So just be careful...

Actually what happens with Sybase is this:

If $sth has pending results when prepare() is called DBD::Sybase opens 
a new connection (because it sees that the $dbh already has an active
$sth). When the return value from prepare() is assigned to $sth the
DESTROY method for the old $sth is called, which cancels the previous
query. 

So I think that you *should* be safe from deadlocks, but the problem
will be getting additional connections created, which is not really
optimal. 

Michael
-- 
Michael Peppler -||-  Data Migrations Inc.
[EMAIL PROTECTED]-||-  http://www.mbay.net/~mpeppler
Int. Sybase User Group  -||-  http://www.isug.com
Sybase on Linux mailing list: [EMAIL PROTECTED]



RE: Question about $sth-finish;

2000-08-15 Thread Matt Sergeant

On Tue, 15 Aug 2000, Michael Peppler wrote:

 Matt Sergeant writes:
   On Tue, 15 Aug 2000, Vladislav Safronov wrote:
   
Ok. I think, the answers clear the problem, but I have yet more question.

What can you say about this code? is it ok (overwriting previous handle)?
   
   [snip]
   
   Well it depends on the DBMS. For example Sybase might not like it if you
   haven't read everything from the $sth first - it will bite you in the bum
   with locks. Others will be fine. So just be careful...
 
 Actually what happens with Sybase is this:
 
 If $sth has pending results when prepare() is called DBD::Sybase opens 
 a new connection (because it sees that the $dbh already has an active
 $sth). When the return value from prepare() is assigned to $sth the
 DESTROY method for the old $sth is called, which cancels the previous
 query. 
 
 So I think that you *should* be safe from deadlocks, but the problem
 will be getting additional connections created, which is not really
 optimal. 

Isn't there something different happening when AutoCommit = 0 though?

-- 
Matt/

Fastnet Software Ltd. High Performance Web Specialists
Providing mod_perl, XML, Sybase and Oracle solutions
Email for training and consultancy availability.
http://sergeant.org | AxKit: http://axkit.org




RE: Question about $sth-finish;

2000-08-15 Thread Michael Peppler

Matt Sergeant writes:
  On Tue, 15 Aug 2000, Michael Peppler wrote:
  
   Matt Sergeant writes:
 On Tue, 15 Aug 2000, Vladislav Safronov wrote:
 
  Ok. I think, the answers clear the problem, but I have yet more question.
  
  What can you say about this code? is it ok (overwriting previous handle)?
 
 [snip]
 
 Well it depends on the DBMS. For example Sybase might not like it if you
 haven't read everything from the $sth first - it will bite you in the bum
 with locks. Others will be fine. So just be careful...
   
   Actually what happens with Sybase is this:
   
   If $sth has pending results when prepare() is called DBD::Sybase opens 
   a new connection (because it sees that the $dbh already has an active
   $sth). When the return value from prepare() is assigned to $sth the
   DESTROY method for the old $sth is called, which cancels the previous
   query. 
   
   So I think that you *should* be safe from deadlocks, but the problem
   will be getting additional connections created, which is not really
   optimal. 
  
  Isn't there something different happening when AutoCommit = 0 though?

If AutoCommit = 0 then you'll get a fatal error because DBD::Sybase
can't guarantee consistent rollback behavior accross multiple
connections (which is what happens in this case, even though the first 
$sth gets destroyed before the second one gets executed).

Michael
-- 
Michael Peppler -||-  Data Migrations Inc.
[EMAIL PROTECTED]-||-  http://www.mbay.net/~mpeppler
Int. Sybase User Group  -||-  http://www.isug.com
Sybase on Linux mailing list: [EMAIL PROTECTED]



RE: Question about $sth-finish;

2000-08-15 Thread Jay Jacobs



On Tue, 15 Aug 2000, Tom Mornini wrote:

 It is my understanding of the DBI docs that you only need to call
 $sth-finish when you DON'T fetch all the rows that the $sth has ready to
 return.
 

From "Writing Apache Modules with Perl and C":
  "You should still call finish() at the end of each series of fetches,
even though you are going to reuse the statement handler.  Failure to do
so can lead to memory leaks."

If I remember correctly, it also frees up any resources used by the
database (depending on db) for the query, like for sorting, joining,
etc.  But I can't quote a source for that one.

From my point of view, it never hurts to call finish()...

Jay Jacobs




RE: Question about $sth-finish;

2000-08-15 Thread Tom Mornini

On Tue, 15 Aug 2000, Vladislav Safronov wrote:

 Ok. I think, the answers clear the problem, but I have yet more question.
 
 What can you say about this code? is it ok (overwriting previous handle)?
 
 ==
 sub foo {
   my $dbh = shift;
 
   my $sql1 = "select *...
   my $sql2 = "select *...
 
   my $sth = $dbh-prepare($sql1);
   $sth-execute;
   .. fetch some data.
 
   # should be $sth-finish inserted??
 
   $sth = $dbh-prepare($sql2); # we overwrite previous handle saved in $sth
 ..
   $sth-execute;
   .. fetch some data.
   return;
 }

It is my understanding of the DBI docs that you only need to call
$sth-finish when you DON'T fetch all the rows that the $sth has ready to
return.

-- 
-- Tom Mornini
-- InfoMania Printing and Prepress




Re: question - can asp be run as cgi???

2000-05-19 Thread Joshua Chamas

Charles Dalsass wrote:
 
 Hey dudes, new poster here.
 
 I've got a project which the client has said 'no mod perl' but only cgi
 and perl. They've got a really powerful machine, but are 'afraid' of
 using mod_perl (because of memory issues, administration etc).
 Performance should not be an issue.
 
 I also have an employee who knows ASP and some perl. I know that if the
 person writes the web module from scratch (using CGI.pm and perl only),
 it will take about twice as long as it would with Apache::ASP. So I need
 to know if I can run the ASP environment without using mod_perl.
 

The cgi/asp script in the asp distribution may be
your start here, which you may be able to use 
like: #!/usr/bin/perl asp

at the top of your cgi scripts.  You could hack
it up to set all the special config info you need
for your installation.

Also you can try putting at the top of a cgi script:

use Apache::ASP;
Apache::ASP::CGI::do_self;
__END__

% ASP script here%

This is how the test scripts at t/* work in the dist.

Note that I never got Apache::ASP fully working in 
a cgi environment, so you may have to patch it up.  I think
grabbing POST or QUERY input wasn't quite there, thus 
killing the $Request object.

Good luck.

--Joshua
_
Joshua Chamas   Chamas Enterprises Inc.
NodeWorks  free web link monitoring   Huntington Beach, CA  USA 
http://www.nodeworks.com1-714-625-4051

 I've checked out historical postings and noticed that some people
 (Lincoln Stein - seemingly a lively poster) have questioned the use of
 ASP and cgi at all - we'll that's exactly my situation. I've also found
 alot of leads in the right direction, but no final answer (or mysterious
 ASP.pl program).
 
 I've been unable to nail down an answer to the question:
 
 Is there a way to run ASP as a cgi program (interchangably).
 
 What are the steps involved to do that?
 
 Thanks alot for the help,
 
 Charles Dalsass
 www.neptuneweb.com



Re: Question about SendFile.pm from Eagle book

2000-02-12 Thread Frank Wiles

On Sat, 12 Feb 2000 [EMAIL PROTECTED] wrote:

 As a beginner in Mod_perl,
 I have to get the file from the remote host (Mod_perl enabled Apache)
 if not in the local host, so I am currently modifying SendFile.pm in Eagle 
 book
 at
  unless(-e $r-finfo) {
  ...
  instead of giving the nonexistence error message here
  get the file from the remote host ( I assume the file exist there)
  by connecting to the remote host using Socket here 
  ...
 }
  
 But I have difficulties in setting up Socket connection to the remote.
 Can I use just simple Perl Socket here (IO::Socket) ?

  Are you trying to get a file via HTTP? If so check out the
LWP::lwpwww-5.47 module at CPAN.  It will handle and the socket
connections for you and reduce retrieveing a file to "get($URL);".  

  Note I haven't attempted to use this in a mod_perl setting, but I can't
imagine any reason why it shouldn't work. 

 ---
  Frank Wiles [EMAIL PROTECTED]
  http://frank.wiles.org
 ---




Re: Question about error log message and PERL_SSI

2000-02-06 Thread Stas Bekman

 I successfully installed mod_perl under Apache/1.3.6 (Unix). However, when
 attempting to run some Web pages I have that use #perl sub I get an error
 log message, "unknown directive 'perl' in parsed doc."
 
 I installed mod_perl right from CPAN and assumed that mean EVERYTHING=1
 would be the default installation. Is there a way I can find out if my
 mod_perl enables PERL_SSI and therefore find out if this is or is not my
 problem?

EVERYTHING=1 should install PerlSSI as well.

Configure perl-status to work (see 'perldoc Apache::Status') then do: 
http://localhost/perl-status?hooks to check the enabled hooks.

Do other mod_perl scripts/modules work? didn't you forget to:
cd ../apache-x.x.x
make install

___
Stas Bekmanmailto:[EMAIL PROTECTED]  http://www.stason.org/stas
Perl,CGI,Apache,Linux,Web,Java,PC http://www.stason.org/stas/TULARC
perl.apache.orgmodperl.sourcegarden.org   perlmonth.comperl.org
single o- + single o-+ = singlesheavenhttp://www.singlesheaven.com



Re: Question about error log message and PERL_SSI

2000-02-06 Thread gnielson

Replies below:

On Sun, 6 Feb 2000, Stas Bekman wrote:

 Date: Sun, 6 Feb 2000 23:20:49 +0200 (IST)
 From: Stas Bekman [EMAIL PROTECTED]
 To: gnielson [EMAIL PROTECTED]
 Cc: "ModPerl Mailing List (E-mail)" [EMAIL PROTECTED]
 Subject: Re: Question about error log message and PERL_SSI
 
  I successfully installed mod_perl under Apache/1.3.6 (Unix). However, when
  attempting to run some Web pages I have that use #perl sub I get an error
  log message, "unknown directive 'perl' in parsed doc."
  
  I installed mod_perl right from CPAN and assumed that mean EVERYTHING=1
  would be the default installation. Is there a way I can find out if my
  mod_perl enables PERL_SSI and therefore find out if this is or is not my
  problem?
 
 EVERYTHING=1 should install PerlSSI as well.
 
 Configure perl-status to work (see 'perldoc Apache::Status') then do: 
 http://localhost/perl-status?hooks to check the enabled hooks.

Thanks for that information. That showed me that PERL=SSI is *disabled.* 
Guess I need to install again from CPAN, huh? Any way to just enable
PERL=SSI without rebuilding?
 
 Do other mod_perl scripts/modules work? didn't you forget to:
 cd ../apache-x.x.x
 make install

Yes, other scripts do work.
 
 ___
 Stas Bekmanmailto:[EMAIL PROTECTED]  http://www.stason.org/stas
 Perl,CGI,Apache,Linux,Web,Java,PC http://www.stason.org/stas/TULARC
 perl.apache.orgmodperl.sourcegarden.org   perlmonth.comperl.org
 single o- + single o-+ = singlesheavenhttp://www.singlesheaven.com
 



Re: correction! Re: Question about error log message and PERL_SSI

2000-02-06 Thread Ask Bjoern Hansen

On Sun, 6 Feb 2000, Stas Bekman wrote:

[...]
   EVERYTHING=1 should install PerlSSI as well.
   
   Configure perl-status to work (see 'perldoc Apache::Status') then do: 
   http://localhost/perl-status?hooks to check the enabled hooks.
  
  Thanks for that information. That showed me that PERL=SSI is *disabled.* 
  Guess I need to install again from CPAN, huh? Any way to just enable
  PERL=SSI without rebuilding?
 
 Ooops, I was wrong, you need to use ALL_HOOKS=1 to enable all handlers or
 just PERL_SSI=1 for PerlSSI. 
 
 (I thought EVERYTHING=1 installs it all :)

uhmn, EVERYTHING=1 should enable PERL_SSI too. It does for me.


 - ask

-- 
ask bjoern hansen - http://www.netcetera.dk/~ask/
more than 70M impressions per day, http://valueclick.com



Re: correction! Re: Question about error log message and PERL_SSI

2000-02-06 Thread Stas Bekman

[Gary please keep this on the list, CC'ing back to list]

 On Mon, 7 Feb 2000, Stas Bekman wrote:
 
  Date: Mon, 7 Feb 2000 00:01:56 +0200 (IST)
  From: Stas Bekman [EMAIL PROTECTED]
  To: gnielson [EMAIL PROTECTED]
  Cc: "ModPerl Mailing List (E-mail)" [EMAIL PROTECTED]
  Subject: Re: correction! Re: Question about error log message and PERL_SSI
  
Ooops, I was wrong, you need to use ALL_HOOKS=1 to enable all handlers or
just PERL_SSI=1 for PerlSSI. 

(I thought EVERYTHING=1 installs it all :)
   
   So I guess I need to rebuild it manually, eh, with ALL_HOOKS=1? No easier
   way to add this functionality? 
  
  Nope you don't have to. I understand that you use CPAN to install it? See
  my notes about providing additional params at:
  http://perl.apache.org/guide/install.html#mod_perl_Installation_with_CPAN_
  http://perl.apache.org/guide/install.html#Local_mod_perl_Enabled_Apache_In
  
 
 I went to perl.apache.org and thought I understood what I needed to do,
 but still not successful. I thought that what i needed to do was specify
 new parameters and then re-run install mod_perl with these new parameters.
 But the install reports up to date and just quits.
 
 Here's what I did:
 
 cpan o conf makepl_arg
 makepl_argDO HTTPD=1 USE_APACI=1 EVERYTHING=1
 PREFIX=/usr/local/apache APACHE_PREFIX=/usr/local/apache
 cpan o conf makepl_arg.save EVERYTHING=1
 makepl_arg.saveEVERYTHING=1
 cpan install mod_perl
 mod_perl is up to date.

CPAN is not build params aware. If you want to force the rebuild, use
'force'

cpan force install mod_perl

 cpan quit
 
 When I do a http://localhost/perl-status?hooks I still get PERL_SSI
 Disabled. 

Of course, nothing has changed!

  Are you sure the default build uses EVERYTHING=1 when gets build thru
  CPAN.pm? I'm still in doubt about EVERYTHING=1 not installing all. It
  should install everything according to the docs. I think 
  cpan install mod_perl
  doesn't provide this parameter... please confirm. Thanks
  
  
  ___
  Stas Bekmanmailto:[EMAIL PROTECTED]  http://www.stason.org/stas
  Perl,CGI,Apache,Linux,Web,Java,PC http://www.stason.org/stas/TULARC
  perl.apache.orgmodperl.sourcegarden.org   perlmonth.comperl.org
  single o- + single o-+ = singlesheavenhttp://www.singlesheaven.com
  
 
 



___
Stas Bekmanmailto:[EMAIL PROTECTED]  http://www.stason.org/stas
Perl,CGI,Apache,Linux,Web,Java,PC http://www.stason.org/stas/TULARC
perl.apache.orgmodperl.sourcegarden.org   perlmonth.comperl.org
single o- + single o-+ = singlesheavenhttp://www.singlesheaven.com



Re: question, blessing objects, modifying them

2000-01-27 Thread Jeff Beard

Check out "perldoc perltoot" under Class interface.

Cheers,

Jeff


At 01:43 PM 1/27/00 -0800, Etienne Pelaprat wrote:
hi all,

i'm starting out doing some Object Oriented programming with mod_perl
and I define one object like this:

sub new {
 my $self = shift;
 my $type = ref($self) || $self;

 ## bless our object into the class and return it
 return bless {
 first_name = '',
 last_name = '',
 email_address = '',
 @_
 }, $type;
}

sub AUTOLOAD {
 my $self = shift; ## grab the object we're being called on
 my $type = $self || ref($self);  ## get the object type

return if $AUTOLOAD =~ /^DESTROY$/;

 my $name = $AUTOLOAD;

 $name =~ s/^.*://;

 unless( exists $self-{$name} ) {
 croak "Error: Can't access field '$name' in object of class
$type";
 }

 if (@_) {
 return $self-{$name} = shift;
 } else {
 return $self-{$name};
 }
}

## more functions ##

Let's say this object is called SomePerson, and I create this object in
one of my cgi scripts, like so (image SomePerson is part of package
People):

$some_person = People::SomePerson-new;

how do I change the first_name, last_name, email_address variables?
Would it be like this, if I'm doing it from inside the SomePerson
object:

$self-{first_name} = "Etienne";

and like this from a regular cgi script:

$some_person-first_name = "Etienne";

or how?

Thanks in advance,

Etienne



Jeff Beard
___
Web:www.cyberxape.com
Phone:  303.443.9339
Location:   Boulder, CO, USA




Re: question, blessing objects, modifying them

2000-01-27 Thread Stas Bekman


Etienne, We all love the OO hype letters, but first it's the offtopic
question, second it's the FAQ question. You can hunt for luck at the perl
newsgroup or other perl generic list. But save your time and frustration
-- read some books, for example 'Object Oriented Perl' by Domian and 'Perl
CookBook' by Tom and Nathan, and of course the perl manpages (hint: 
perldoc perl)

 hi all,
 
 i'm starting out doing some Object Oriented programming with mod_perl 
 and I define one object like this:
 
 sub new {
   my $self = shift;
   my $type = ref($self) || $self;
 
   ## bless our object into the class and return it
   return bless {
   first_name = '',
   last_name = '',
   email_address = '',
   @_
   }, $type;
 }
 
 sub AUTOLOAD {
   my $self = shift; ## grab the object we're being called on
   my $type = $self || ref($self);  ## get the object type
 
return if $AUTOLOAD =~ /^DESTROY$/;
 
   my $name = $AUTOLOAD;
 
   $name =~ s/^.*://;
 
   unless( exists $self-{$name} ) {
   croak "Error: Can't access field '$name' in object of class 
 $type";
   }
 
   if (@_) {
   return $self-{$name} = shift;
   } else {
   return $self-{$name};
   }
 }
 
 ## more functions ##
 
 Let's say this object is called SomePerson, and I create this object in 
 one of my cgi scripts, like so (image SomePerson is part of package 
 People):
 
 $some_person = People::SomePerson-new;
 
 how do I change the first_name, last_name, email_address variables?  
 Would it be like this, if I'm doing it from inside the SomePerson 
 object:
 
 $self-{first_name} = "Etienne";
 
 and like this from a regular cgi script:
 
 $some_person-first_name = "Etienne";
 
 or how?
 
 Thanks in advance,
 
 Etienne
 



___
Stas Bekmanmailto:[EMAIL PROTECTED]  http://www.stason.org/stas
Perl,CGI,Apache,Linux,Web,Java,PC http://www.stason.org/stas/TULARC
perl.apache.orgmodperl.sourcegarden.org   perlmonth.comperl.org
single o- + single o-+ = singlesheavenhttp://www.singlesheaven.com



  1   2   >