Re: pnotes and notes not working from Apache::Registry to handler

2003-07-16 Thread Mark Maunder
thanks. :)

I've ploughed through the manual and I'm pretty sure I've been trying
both notes and pnotes correctly. There's also a fairly common mistake of
assuming you're dealing with the initial request, when in fact
Apache->request is a sub-request and you need to use $r->main to
retrieve the main request to access your pnotes. I'm not making that
mistake either. 

The last option you mention about mod_perl compilation options: I've
compiled with EVERYTHING=1 and I even grep'd the apache and mod_perl
source just now for 'pnotes' to see if I could spot anything. Nothing
popped out at me. 

I'll try to recompile with
PLUS_THAT_OTHER_LITTLE_THING_NOT_INCLUDED_IN_EVERYTHING=1 now and see if
I have better luck ;)

On Wed, 2003-07-16 at 22:58, Dennis Stout wrote:
> > I'm trying to store data about a user who has authenticated in
> > $r->pnotes so that a perl logging phase handler can stick the user_id in
> > the db. I call $r->pnotes('keyname' => 'somevalue'); in an apache
> > registry script, and then call $r->pnotes('keyname') in the logging
> > handler later on during the logging phase, but am getting nothing back.
> > No errors, just undef. I've tried notes too, and no luck their either.
> > I'm using Apache::Request btw. I've also tried retreiving a tied hash
> > using $r->pnotes() and there are no key/values in that either.
> 
> the mod_perl API book specifically said pnotes is the way to communicate
> between handlers.  As I have hte PDF version, I can't exactly cut & paste it
> easily...
> 
> pnotes gets cleared after every request, so good thinking on trying notes, as
> it apearently doesn't.
> 
> the basic usage is this:
> 
> $r->pnotes("MY_HANDLER" => [qw(one two)]);
> my $val = $r->pnotes("MY_HANDLER");
> print $val->[0]; # prints "one"
> 
> So basically, $r->pnotes("MY_HANDLER" => [qw(one two)]); will create a hash
> where MY_HANDLER is a key to an anonymous array.
> 
> my $val = $r->pnotes("MY_HANDLER"); sets $val to be the reference to that
> array.
> 
> print $val->[0]; dereferences the first spot in the array reference.  The
> dereferencing thing is key here.  $val[0] will throw errors about globals not
> being declared as arrays or something of that sort.
> 
> 
> > Did I forget to compile apache or mod_perl with an option of some sort?
> > I can't think of any other explanation. I compiled mod_perl with
> > EVERYTHING=1
> 
> There is the problem right there.  It needs to be compiled with "EVERYTHING=1
> PLUS_THAT_OTHER_LITTLE_THING_NOT_INCLUDED_IN_EVERYTHING=1".
> 
> :P
> 
> Dennis
-- 
Mark Maunder <[EMAIL PROTECTED]>
ZipTree Inc.



Re: pnotes and notes not working from Apache::Registry to handler

2003-07-16 Thread Dennis Stout
> I'm trying to store data about a user who has authenticated in
> $r->pnotes so that a perl logging phase handler can stick the user_id in
> the db. I call $r->pnotes('keyname' => 'somevalue'); in an apache
> registry script, and then call $r->pnotes('keyname') in the logging
> handler later on during the logging phase, but am getting nothing back.
> No errors, just undef. I've tried notes too, and no luck their either.
> I'm using Apache::Request btw. I've also tried retreiving a tied hash
> using $r->pnotes() and there are no key/values in that either.

the mod_perl API book specifically said pnotes is the way to communicate
between handlers.  As I have hte PDF version, I can't exactly cut & paste it
easily...

pnotes gets cleared after every request, so good thinking on trying notes, as
it apearently doesn't.

the basic usage is this:

$r->pnotes("MY_HANDLER" => [qw(one two)]);
my $val = $r->pnotes("MY_HANDLER");
print $val->[0]; # prints "one"

So basically, $r->pnotes("MY_HANDLER" => [qw(one two)]); will create a hash
where MY_HANDLER is a key to an anonymous array.

my $val = $r->pnotes("MY_HANDLER"); sets $val to be the reference to that
array.

print $val->[0]; dereferences the first spot in the array reference.  The
dereferencing thing is key here.  $val[0] will throw errors about globals not
being declared as arrays or something of that sort.


> Did I forget to compile apache or mod_perl with an option of some sort?
> I can't think of any other explanation. I compiled mod_perl with
> EVERYTHING=1

There is the problem right there.  It needs to be compiled with "EVERYTHING=1
PLUS_THAT_OTHER_LITTLE_THING_NOT_INCLUDED_IN_EVERYTHING=1".

:P

Dennis



Re: cookies

2003-07-16 Thread Dennis Stout
WOOO!

I went to the ttms site, logged in, AND IT AUTHNTICATED ME AND GAVE ME PAGES!!
:D

Aight,  is on me tonight :D

I can't beleive it!  3 weeks on this bloody thing and I got it to finally
Authenticat me =D

Course, I had to disable things in order to get it to give me a cookie to
authenticate with, but a few if's will fix that :D

I'm happy, I'm happy, I'm happy!  I might actually meet deadline :D

w00t!

er...  *ahem*

My thanks to all of you, and special thanks to Mark who helped me the most :D

Dennis



Re: cookies

2003-07-16 Thread Dennis Stout
> Cool dude. Now if you know why $r->pnotes() isn't working under
> apache/modperl .27 you'll make my day!

Got some source code to show me what you're doing with it?

Otherwise I'll just have to cut and paste the mod_perl API book to you ;)
hehehehe.

Dennis




Re: cookies

2003-07-16 Thread Mark Maunder
Cool dude. Now if you know why $r->pnotes() isn't working under
apache/modperl .27 you'll make my day! 

:wq

On Wed, 2003-07-16 at 21:42, Dennis Stout wrote:
> w00t!
> 
> ttms_user: mp2Ti5p1JkhCObm9LKBFGsiAltop8aAWwl6vLLDr/3rtb09MRzZrEg==
> 
> Here,
> 
> your $cookie = Apache::Cookie->new($state->{r},
> -name   => 'Mark',
> -value  => 'AWESOME!!!',
> -expires=> time + 86400*30*7,
> -domain => '.dyndns.org',
> -path   => '/',
> );
> 
> (okay, I made up "your", it sounds better than "my", and sinec this is fake
> nayways... heh)
> 
> oop, looking at that, I should set the domain to something more sane again,
> like stout.dyndns.org.  :P
> 
> Dennis
> 
> P.S. Does anyone else try to use Outlook Express like vi and get odd error
> messages after a days worth of coding?
> 
> - Original Message - 
> From: "Mark Maunder" <[EMAIL PROTECTED]>
> To: "Dennis Stout" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Wednesday, July 16, 2003 20 33
> Subject: Re: cookies
> 
> 
> > >From perldoc CGI::Cookie
> > # fetch existing cookies
> > %cookies = fetch CGI::Cookie;
> > $id = $cookies{'ID'}->value;
> > #You're doing $cookies->value;
> >
> > ID == the name that you used when you set the cookie.
> >
> > On Wed, 2003-07-16 at 21:27, Dennis Stout wrote:
> > > *pounds head against brick wall*  why must it work against me???
> > >
> > > A cookie for anyone who solves this.
> > >
> > > sub handler {
> > > my $r = shift;
> > > my $result = undef;
> > >
> > > eval { $result = inner_handler($r) };
> > > return $result unless $@;
> > >
> > > warn "Uncaught Exception: $@";
> > >
> > > return SERVER_ERROR;
> > > }
> > >
> > > sub inner_handler {
> > > my $r = shift;
> > >
> > > my %q = ($r->args, $r->content);
> > > my %state = (r => $r, q => \%q);
> > >
> > > $state{title} = '';
> > > $state{template} = '';
> > > $state{auth_status} = password_boxes(\%state);
> > >
> > > #   warn "%ENV: \n";
> > > #   foreach (keys %ENV) {
> > > #   warn "$_ => $ENV{$_}\n";
> > > #   }
> > > #   my %headers = $r->headers_in;
> > > #   warn "Headers: \n";
> > > #   foreach (keys %headers) {
> > > #   warn "$_: $headers{$_}\n";
> > > #   }
> > > my $cookie = Apache::Cookie->fetch;
> > > warn "z - $cookie->value";
> > > validate_auth_cookie(\%state, $cookie);
> > >
> > > my $function = $r->uri;
> > > if (($state{login_user} eq '') and ($function ne '/login.cgi')) {
> > > $function = '/login.html';
> > > }
> > > my $func = $Dispatch{$function} || $Dispatch{DEFAULT};
> > >
> > > return DECLINED unless $func;
> > > return $func->(\%state);
> > > }
> > >
> > > Upon accessing a page (therefore generating lots of warning info in
> logs...) I
> > > get this in my error log.
> > >
> > > z - HASH(0x916ea08)->value at /home/httpd/ttms/perl/RequestHandler.pm line
> > > 108.
> > >
> > > (the z is there so I know where at in my code the line in the log file is
> > > being generated.  I like z's and a's more than I do
> > > "some/long/path/and/filename line 108")
> > >
> > > I have tried using $cookie as a value in and of itself, I've tried
> > > $cookie->{ttms_user}  (the name of hte cookie is ttms_user), I've tried
> > > changing $cookie to %cookie and doing a $cookie{ttms_user} ..
> > >
> > > I might break down, declare this a bug, and use $ENV{HTTP_COOKIE} instead.
> > >
> > > Any ideas how to fix this to return to me the cookie itself?  Thanks.
> > >
> > > Dennis
> > >
> > > - Original Message - 
> > > From: "Dennis Stout" <[EMAIL PROTECTED]>
> > > To: "Dennis Stout" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> > > Sent: Wednesday, July 16, 2003 20 13
> > > Subject: Re: cookies
> > >
> > >
> > > > Well I'll be damned.
> > > >
> > > > My computer at home does the cookie thing perfectly well.  My
> workstation at
> > > > work does not do cookies.  So my mod_perl creation is working fine as
> far as
> > > > getting the cookies.
> > > >
> > > > 
> > > > YAY FOR WIN2K DOMAINS AND ADMIN WHO USE HELP DESK TECHS TO PROGRAM
> TICKETING
> > > > SYSTEMS FOR DSL, DIGITAL TV, AND DOMAINS!
> > > > 
> > > >
> > > > I still have a problem tho.  The cookie string itself is not being
> passed
> > > > along.  Instead, I am getting Apache::Cookie=SCALAR(0x9115c24).
> > > >
> > > > I imagine somewhere I need to do something like ->as_string or
> something.
> > > > blah
> > > >
> > > > Thanks for helping, sorry I didn't spot that the error was infact, in
> the
> > > > dumbterminal called a win2k box I was using, and not in any actual
> code
> > > >
> > > > Dennis Stout
> > > >
> > > > - Original Message - 
> > > > From: "Dennis Stout" <[EMAIL PROTECTED]>
> > > > To: <[EMAIL PRO

Re: cookies

2003-07-16 Thread Dennis Stout
w00t!

ttms_user: mp2Ti5p1JkhCObm9LKBFGsiAltop8aAWwl6vLLDr/3rtb09MRzZrEg==

Here,

your $cookie = Apache::Cookie->new($state->{r},
-name   => 'Mark',
-value  => 'AWESOME!!!',
-expires=> time + 86400*30*7,
-domain => '.dyndns.org',
-path   => '/',
);

(okay, I made up "your", it sounds better than "my", and sinec this is fake
nayways... heh)

oop, looking at that, I should set the domain to something more sane again,
like stout.dyndns.org.  :P

Dennis

P.S. Does anyone else try to use Outlook Express like vi and get odd error
messages after a days worth of coding?

- Original Message - 
From: "Mark Maunder" <[EMAIL PROTECTED]>
To: "Dennis Stout" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Wednesday, July 16, 2003 20 33
Subject: Re: cookies


> >From perldoc CGI::Cookie
> # fetch existing cookies
> %cookies = fetch CGI::Cookie;
> $id = $cookies{'ID'}->value;
> #You're doing $cookies->value;
>
> ID == the name that you used when you set the cookie.
>
> On Wed, 2003-07-16 at 21:27, Dennis Stout wrote:
> > *pounds head against brick wall*  why must it work against me???
> >
> > A cookie for anyone who solves this.
> >
> > sub handler {
> > my $r = shift;
> > my $result = undef;
> >
> > eval { $result = inner_handler($r) };
> > return $result unless $@;
> >
> > warn "Uncaught Exception: $@";
> >
> > return SERVER_ERROR;
> > }
> >
> > sub inner_handler {
> > my $r = shift;
> >
> > my %q = ($r->args, $r->content);
> > my %state = (r => $r, q => \%q);
> >
> > $state{title} = '';
> > $state{template} = '';
> > $state{auth_status} = password_boxes(\%state);
> >
> > #   warn "%ENV: \n";
> > #   foreach (keys %ENV) {
> > #   warn "$_ => $ENV{$_}\n";
> > #   }
> > #   my %headers = $r->headers_in;
> > #   warn "Headers: \n";
> > #   foreach (keys %headers) {
> > #   warn "$_: $headers{$_}\n";
> > #   }
> > my $cookie = Apache::Cookie->fetch;
> > warn "z - $cookie->value";
> > validate_auth_cookie(\%state, $cookie);
> >
> > my $function = $r->uri;
> > if (($state{login_user} eq '') and ($function ne '/login.cgi')) {
> > $function = '/login.html';
> > }
> > my $func = $Dispatch{$function} || $Dispatch{DEFAULT};
> >
> > return DECLINED unless $func;
> > return $func->(\%state);
> > }
> >
> > Upon accessing a page (therefore generating lots of warning info in
logs...) I
> > get this in my error log.
> >
> > z - HASH(0x916ea08)->value at /home/httpd/ttms/perl/RequestHandler.pm line
> > 108.
> >
> > (the z is there so I know where at in my code the line in the log file is
> > being generated.  I like z's and a's more than I do
> > "some/long/path/and/filename line 108")
> >
> > I have tried using $cookie as a value in and of itself, I've tried
> > $cookie->{ttms_user}  (the name of hte cookie is ttms_user), I've tried
> > changing $cookie to %cookie and doing a $cookie{ttms_user} ..
> >
> > I might break down, declare this a bug, and use $ENV{HTTP_COOKIE} instead.
> >
> > Any ideas how to fix this to return to me the cookie itself?  Thanks.
> >
> > Dennis
> >
> > - Original Message - 
> > From: "Dennis Stout" <[EMAIL PROTECTED]>
> > To: "Dennis Stout" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> > Sent: Wednesday, July 16, 2003 20 13
> > Subject: Re: cookies
> >
> >
> > > Well I'll be damned.
> > >
> > > My computer at home does the cookie thing perfectly well.  My
workstation at
> > > work does not do cookies.  So my mod_perl creation is working fine as
far as
> > > getting the cookies.
> > >
> > > 
> > > YAY FOR WIN2K DOMAINS AND ADMIN WHO USE HELP DESK TECHS TO PROGRAM
TICKETING
> > > SYSTEMS FOR DSL, DIGITAL TV, AND DOMAINS!
> > > 
> > >
> > > I still have a problem tho.  The cookie string itself is not being
passed
> > > along.  Instead, I am getting Apache::Cookie=SCALAR(0x9115c24).
> > >
> > > I imagine somewhere I need to do something like ->as_string or
something.
> > > blah
> > >
> > > Thanks for helping, sorry I didn't spot that the error was infact, in
the
> > > dumbterminal called a win2k box I was using, and not in any actual
code
> > >
> > > Dennis Stout
> > >
> > > - Original Message - 
> > > From: "Dennis Stout" <[EMAIL PROTECTED]>
> > > To: <[EMAIL PROTECTED]>
> > > Sent: Wednesday, July 16, 2003 13 13
> > > Subject: cookies
> > >
> > >
> > > > Okay, so technically this isn't really "mod_perl" speific...  but the
> > cookie
> > > > is being set with mod_perl and it's a huge mod_perl program being
affected
> > > by
> > > > this:)
> > > >
> > > > I have a cookie, the domain is set to .stout.dyndns.org (with the
leading
> > > .).
> > > >
> > > > I set the cookie just fine now (thanks to those helping me on 

Re: cookies

2003-07-16 Thread Mark Maunder
>From perldoc CGI::Cookie
# fetch existing cookies
%cookies = fetch CGI::Cookie;
$id = $cookies{'ID'}->value;
#You're doing $cookies->value;

ID == the name that you used when you set the cookie.

On Wed, 2003-07-16 at 21:27, Dennis Stout wrote:
> *pounds head against brick wall*  why must it work against me???
> 
> A cookie for anyone who solves this.
> 
> sub handler {
> my $r = shift;
> my $result = undef;
> 
> eval { $result = inner_handler($r) };
> return $result unless $@;
> 
> warn "Uncaught Exception: $@";
> 
> return SERVER_ERROR;
> }
> 
> sub inner_handler {
> my $r = shift;
> 
> my %q = ($r->args, $r->content);
> my %state = (r => $r, q => \%q);
> 
> $state{title} = '';
> $state{template} = '';
> $state{auth_status} = password_boxes(\%state);
> 
> #   warn "%ENV: \n";
> #   foreach (keys %ENV) {
> #   warn "$_ => $ENV{$_}\n";
> #   }
> #   my %headers = $r->headers_in;
> #   warn "Headers: \n";
> #   foreach (keys %headers) {
> #   warn "$_: $headers{$_}\n";
> #   }
> my $cookie = Apache::Cookie->fetch;
> warn "z - $cookie->value";
> validate_auth_cookie(\%state, $cookie);
> 
> my $function = $r->uri;
> if (($state{login_user} eq '') and ($function ne '/login.cgi')) {
> $function = '/login.html';
> }
> my $func = $Dispatch{$function} || $Dispatch{DEFAULT};
> 
> return DECLINED unless $func;
> return $func->(\%state);
> }
> 
> Upon accessing a page (therefore generating lots of warning info in logs...) I
> get this in my error log.
> 
> z - HASH(0x916ea08)->value at /home/httpd/ttms/perl/RequestHandler.pm line
> 108.
> 
> (the z is there so I know where at in my code the line in the log file is
> being generated.  I like z's and a's more than I do
> "some/long/path/and/filename line 108")
> 
> I have tried using $cookie as a value in and of itself, I've tried
> $cookie->{ttms_user}  (the name of hte cookie is ttms_user), I've tried
> changing $cookie to %cookie and doing a $cookie{ttms_user} ..
> 
> I might break down, declare this a bug, and use $ENV{HTTP_COOKIE} instead.
> 
> Any ideas how to fix this to return to me the cookie itself?  Thanks.
> 
> Dennis
> 
> - Original Message - 
> From: "Dennis Stout" <[EMAIL PROTECTED]>
> To: "Dennis Stout" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Wednesday, July 16, 2003 20 13
> Subject: Re: cookies
> 
> 
> > Well I'll be damned.
> >
> > My computer at home does the cookie thing perfectly well.  My workstation at
> > work does not do cookies.  So my mod_perl creation is working fine as far as
> > getting the cookies.
> >
> > 
> > YAY FOR WIN2K DOMAINS AND ADMIN WHO USE HELP DESK TECHS TO PROGRAM TICKETING
> > SYSTEMS FOR DSL, DIGITAL TV, AND DOMAINS!
> > 
> >
> > I still have a problem tho.  The cookie string itself is not being passed
> > along.  Instead, I am getting Apache::Cookie=SCALAR(0x9115c24).
> >
> > I imagine somewhere I need to do something like ->as_string or something.
> > blah
> >
> > Thanks for helping, sorry I didn't spot that the error was infact, in the
> > dumbterminal called a win2k box I was using, and not in any actual code
> >
> > Dennis Stout
> >
> > - Original Message - 
> > From: "Dennis Stout" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Wednesday, July 16, 2003 13 13
> > Subject: cookies
> >
> >
> > > Okay, so technically this isn't really "mod_perl" speific...  but the
> cookie
> > > is being set with mod_perl and it's a huge mod_perl program being affected
> > by
> > > this:)
> > >
> > > I have a cookie, the domain is set to .stout.dyndns.org (with the leading
> > .).
> > >
> > > I set the cookie just fine now (thanks to those helping me on thatr)
> > >
> > > I had a problem parsing the cookie.  Added some debugging (okay, warn
> lines
> > up
> > > the yingyang) and after cycling through the headers and warning them out
> to
> > > the errorlog...  I never saw any cookie info.
> > >
> > > So... If the website is ttms.stout.dyndns.org shouldn't the cookie domain
> be
> > > .stout.dyndns.org?
> > >
> > > *sigh*  6 more days to finish this database.  I doubt I'll make it.
> > >
> > > Dennis
> > >
> >
-- 
Mark Maunder <[EMAIL PROTECTED]>
ZipTree Inc.



Re: cookies

2003-07-16 Thread Dennis Stout
*pounds head against brick wall*  why must it work against me???

A cookie for anyone who solves this.

sub handler {
my $r = shift;
my $result = undef;

eval { $result = inner_handler($r) };
return $result unless $@;

warn "Uncaught Exception: $@";

return SERVER_ERROR;
}

sub inner_handler {
my $r = shift;

my %q = ($r->args, $r->content);
my %state = (r => $r, q => \%q);

$state{title} = '';
$state{template} = '';
$state{auth_status} = password_boxes(\%state);

#   warn "%ENV: \n";
#   foreach (keys %ENV) {
#   warn "$_ => $ENV{$_}\n";
#   }
#   my %headers = $r->headers_in;
#   warn "Headers: \n";
#   foreach (keys %headers) {
#   warn "$_: $headers{$_}\n";
#   }
my $cookie = Apache::Cookie->fetch;
warn "z - $cookie->value";
validate_auth_cookie(\%state, $cookie);

my $function = $r->uri;
if (($state{login_user} eq '') and ($function ne '/login.cgi')) {
$function = '/login.html';
}
my $func = $Dispatch{$function} || $Dispatch{DEFAULT};

return DECLINED unless $func;
return $func->(\%state);
}

Upon accessing a page (therefore generating lots of warning info in logs...) I
get this in my error log.

z - HASH(0x916ea08)->value at /home/httpd/ttms/perl/RequestHandler.pm line
108.

(the z is there so I know where at in my code the line in the log file is
being generated.  I like z's and a's more than I do
"some/long/path/and/filename line 108")

I have tried using $cookie as a value in and of itself, I've tried
$cookie->{ttms_user}  (the name of hte cookie is ttms_user), I've tried
changing $cookie to %cookie and doing a $cookie{ttms_user} ..

I might break down, declare this a bug, and use $ENV{HTTP_COOKIE} instead.

Any ideas how to fix this to return to me the cookie itself?  Thanks.

Dennis

- Original Message - 
From: "Dennis Stout" <[EMAIL PROTECTED]>
To: "Dennis Stout" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, July 16, 2003 20 13
Subject: Re: cookies


> Well I'll be damned.
>
> My computer at home does the cookie thing perfectly well.  My workstation at
> work does not do cookies.  So my mod_perl creation is working fine as far as
> getting the cookies.
>
> 
> YAY FOR WIN2K DOMAINS AND ADMIN WHO USE HELP DESK TECHS TO PROGRAM TICKETING
> SYSTEMS FOR DSL, DIGITAL TV, AND DOMAINS!
> 
>
> I still have a problem tho.  The cookie string itself is not being passed
> along.  Instead, I am getting Apache::Cookie=SCALAR(0x9115c24).
>
> I imagine somewhere I need to do something like ->as_string or something.
> blah
>
> Thanks for helping, sorry I didn't spot that the error was infact, in the
> dumbterminal called a win2k box I was using, and not in any actual code
>
> Dennis Stout
>
> - Original Message - 
> From: "Dennis Stout" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, July 16, 2003 13 13
> Subject: cookies
>
>
> > Okay, so technically this isn't really "mod_perl" speific...  but the
cookie
> > is being set with mod_perl and it's a huge mod_perl program being affected
> by
> > this:)
> >
> > I have a cookie, the domain is set to .stout.dyndns.org (with the leading
> .).
> >
> > I set the cookie just fine now (thanks to those helping me on thatr)
> >
> > I had a problem parsing the cookie.  Added some debugging (okay, warn
lines
> up
> > the yingyang) and after cycling through the headers and warning them out
to
> > the errorlog...  I never saw any cookie info.
> >
> > So... If the website is ttms.stout.dyndns.org shouldn't the cookie domain
be
> > .stout.dyndns.org?
> >
> > *sigh*  6 more days to finish this database.  I doubt I'll make it.
> >
> > Dennis
> >
>



Re: cookies

2003-07-16 Thread Dennis Stout
Well I'll be damned.

My computer at home does the cookie thing perfectly well.  My workstation at
work does not do cookies.  So my mod_perl creation is working fine as far as
getting the cookies.


YAY FOR WIN2K DOMAINS AND ADMIN WHO USE HELP DESK TECHS TO PROGRAM TICKETING
SYSTEMS FOR DSL, DIGITAL TV, AND DOMAINS!


I still have a problem tho.  The cookie string itself is not being passed
along.  Instead, I am getting Apache::Cookie=SCALAR(0x9115c24).

I imagine somewhere I need to do something like ->as_string or something.
blah

Thanks for helping, sorry I didn't spot that the error was infact, in the
dumbterminal called a win2k box I was using, and not in any actual code

Dennis Stout

- Original Message - 
From: "Dennis Stout" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, July 16, 2003 13 13
Subject: cookies


> Okay, so technically this isn't really "mod_perl" speific...  but the cookie
> is being set with mod_perl and it's a huge mod_perl program being affected
by
> this:)
>
> I have a cookie, the domain is set to .stout.dyndns.org (with the leading
.).
>
> I set the cookie just fine now (thanks to those helping me on thatr)
>
> I had a problem parsing the cookie.  Added some debugging (okay, warn lines
up
> the yingyang) and after cycling through the headers and warning them out to
> the errorlog...  I never saw any cookie info.
>
> So... If the website is ttms.stout.dyndns.org shouldn't the cookie domain be
> .stout.dyndns.org?
>
> *sigh*  6 more days to finish this database.  I doubt I'll make it.
>
> Dennis
>



Re: Problem configuring and making mod_perl

2003-07-16 Thread Richard Kurth
Thanks for the suggestion but it did not work I still get the same error. 
Also this is a rh9.0 Server

I hit the same error trying to build on a rh9.0 workstation. This solved
my problem:
CPPFLAGS=-I/usr/kerberos/include
export CPPFLAGS
Than unpack, config, make, etc ...

On Wed, 16 Jul 2003, Richard Kurth wrote:

> I am trying to compile mod_perl-1.28 with apache_1.3.27,openssl-0.9.7b and
> mod_ssl-2.8.12-1.3.27. When I run configure with the following and then do
> a make I get all these parse error can anybody tell me way I get this.
>
> THIS IS WHAT I AM RUNNING TO CONFIGURE
> perl Makefile.PL USE_APACI=1 EVERYTHING=1 \
>  DO_HTTPD=1 SSL_BASE=/usr/ \
>  APACHE_PREFIX=/usr/apache \
>  APACHE_SRC=../apache_1.3.27/src \
>  APACI_ARGS='--enable-module=rewrite --enable-shared=rewrite \
> --sysconfdir=/etc/httpd/conf --logfiledir=/home/log 
--manualdir=/home/manual \
> --server-uid=apache --server-gid=apache --enable-module=so
> --htdocsdir=/home/sites \
> --cgidir=/home/cgi-bin --enable-module=proxy --enable-shared=proxy
> --enable-module=ssl \
> --enable-shared=ssl --enable-module=access --enable-module=autoindex '
>
>
> THIS IS WHAT I GET WHEN I DO A MAKE IT SEAMS TO HAVE SOMETHING TO DO WITH
> OPENSSL
> gcc -c -I../.. -I/usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE
> -I../../os/unix -I../../include   -DLINUX=22 -I/usr/include/gdbm
> -DMOD_SSL=208112 -DMOD_PERL -DUSE_PERL_SSI
> -D_REENTRANT  -DTHREADS_HAVE_PIDS -DDEBUGGING -fno-strict-aliasing
> -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
> -I/usr/include/gdbm -DUSE_HSREGEX -DEAPI -D_REENTRANT -DTHREADS_HAVE_PIDS
> -DDEBUGGING -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE
> -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm `../../apaci` -fpic
> -DSHARED_MODULE -DSSL_COMPAT -DSSL_USE_SDBM -DSSL_ENGINE -I/usr//include
> -DMOD_SSL_VERSION=\"2.8.12\" mod_ssl.c && mv mod_ssl.o mod_ssl.lo
> In file included from /usr/include/openssl/ssl.h:179,
>   from mod_ssl.h:116,
>   from mod_ssl.c:65:
> /usr/include/openssl/kssl.h:72:18: krb5.h: No such file or directory
> In file included from /usr/include/openssl/ssl.h:179,
>   from mod_ssl.h:116,
>   from mod_ssl.c:65:
> /usr/include/openssl/kssl.h:132: parse error before "krb5_enctype"
> /usr/include/openssl/kssl.h:134: parse error before "FAR"
> /usr/include/openssl/kssl.h:135: parse error before '}' token
> /usr/include/openssl/kssl.h:147: parse error before "kssl_ctx_setstring"
> /usr/include/openssl/kssl.h:147: parse error before '*' token
> /usr/include/openssl/kssl.h:148: parse error before '*' token
> /usr/include/openssl/kssl.h:149: parse error before '*' token
> /usr/include/openssl/kssl.h:149: parse error before '*' token
> /usr/include/openssl/kssl.h:150: parse error before '*' token
> /usr/include/openssl/kssl.h:151: parse error before "kssl_ctx_setprinc"
> /usr/include/openssl/kssl.h:151: parse error before '*' token
> /usr/include/openssl/kssl.h:153: parse error before "kssl_cget_tkt"
> /usr/include/openssl/kssl.h:153: parse error before '*' token
> /usr/include/openssl/kssl.h:155: parse error before "kssl_sget_tkt"
> /usr/include/openssl/kssl.h:155: parse error before '*' token
> /usr/include/openssl/kssl.h:157: parse error before "kssl_ctx_setkey"
> /usr/include/openssl/kssl.h:157: parse error before '*' token
> /usr/include/openssl/kssl.h:159: parse error before "context"
> /usr/include/openssl/kssl.h:160: parse error before 
"kssl_build_principal_2"
> /usr/include/openssl/kssl.h:160: parse error before "context"
> /usr/include/openssl/kssl.h:163: parse error before "kssl_validate_times"
> /usr/include/openssl/kssl.h:163: parse error before "atime"
> /usr/include/openssl/kssl.h:165: parse error before "kssl_check_authent"
> /usr/include/openssl/kssl.h:165: parse error before '*' token
> /usr/include/openssl/kssl.h:167: parse error before "enctype"
> In file included from mod_ssl.h:116,
>   from mod_ssl.c:65:
> /usr/include/openssl/ssl.h:909: parse error before "KSSL_CTX"
> /usr/include/openssl/ssl.h:931: parse error before '}' token
> make[5]: *** [mod_ssl.lo] Error 1
> make[4]: *** [all] Error 1
> make[3]: *** [subdirs] Error 1
> make[3]: Leaving directory `/tmp/builldinstall/apache_1.3.27/src'
> make[2]: *** [build-std] Error 2
> make[2]: Leaving directory `/tmp/builldinstall/apache_1.3.27'
> make[1]: *** [build] Error 2
> make[1]: Leaving directory `/tmp/builldinstall/apache_1.3.27'
> make: *** [apaci_httpd] Error 2
>

--
+ Jon Larsen: Chief Technology Officer, Richweb, Inc.
+ Richweb.com: Providing Internet-Based Business Solutions since 1995
+ GnuPG Public Key: http://richweb.com/jlarsen.gpg
+ Business: (804) 359.2220 x 101; Mobile: (804) 307.6939



Re: Problem configuring and making mod_perl

2003-07-16 Thread C. Jon Larsen

I hit the same error trying to build on a rh9.0 workstation. This solved 
my problem:

CPPFLAGS=-I/usr/kerberos/include
export CPPFLAGS

Than unpack, config, make, etc ...

On Wed, 16 Jul 2003, Richard Kurth wrote:

> I am trying to compile mod_perl-1.28 with apache_1.3.27,openssl-0.9.7b and 
> mod_ssl-2.8.12-1.3.27. When I run configure with the following and then do 
> a make I get all these parse error can anybody tell me way I get this.
> 
> THIS IS WHAT I AM RUNNING TO CONFIGURE
> perl Makefile.PL USE_APACI=1 EVERYTHING=1 \
>  DO_HTTPD=1 SSL_BASE=/usr/ \
>  APACHE_PREFIX=/usr/apache \
>  APACHE_SRC=../apache_1.3.27/src \
>  APACI_ARGS='--enable-module=rewrite --enable-shared=rewrite \
> --sysconfdir=/etc/httpd/conf --logfiledir=/home/log --manualdir=/home/manual \
> --server-uid=apache --server-gid=apache --enable-module=so 
> --htdocsdir=/home/sites \
> --cgidir=/home/cgi-bin --enable-module=proxy --enable-shared=proxy 
> --enable-module=ssl \
> --enable-shared=ssl --enable-module=access --enable-module=autoindex '
> 
> 
> THIS IS WHAT I GET WHEN I DO A MAKE IT SEAMS TO HAVE SOMETHING TO DO WITH 
> OPENSSL
> gcc -c -I../.. -I/usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE 
> -I../../os/unix -I../../include   -DLINUX=22 -I/usr/include/gdbm 
> -DMOD_SSL=208112 -DMOD_PERL -DUSE_PERL_SSI 
> -D_REENTRANT  -DTHREADS_HAVE_PIDS -DDEBUGGING -fno-strict-aliasing 
> -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 
> -I/usr/include/gdbm -DUSE_HSREGEX -DEAPI -D_REENTRANT -DTHREADS_HAVE_PIDS 
> -DDEBUGGING -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE 
> -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm `../../apaci` -fpic 
> -DSHARED_MODULE -DSSL_COMPAT -DSSL_USE_SDBM -DSSL_ENGINE -I/usr//include 
> -DMOD_SSL_VERSION=\"2.8.12\" mod_ssl.c && mv mod_ssl.o mod_ssl.lo
> In file included from /usr/include/openssl/ssl.h:179,
>   from mod_ssl.h:116,
>   from mod_ssl.c:65:
> /usr/include/openssl/kssl.h:72:18: krb5.h: No such file or directory
> In file included from /usr/include/openssl/ssl.h:179,
>   from mod_ssl.h:116,
>   from mod_ssl.c:65:
> /usr/include/openssl/kssl.h:132: parse error before "krb5_enctype"
> /usr/include/openssl/kssl.h:134: parse error before "FAR"
> /usr/include/openssl/kssl.h:135: parse error before '}' token
> /usr/include/openssl/kssl.h:147: parse error before "kssl_ctx_setstring"
> /usr/include/openssl/kssl.h:147: parse error before '*' token
> /usr/include/openssl/kssl.h:148: parse error before '*' token
> /usr/include/openssl/kssl.h:149: parse error before '*' token
> /usr/include/openssl/kssl.h:149: parse error before '*' token
> /usr/include/openssl/kssl.h:150: parse error before '*' token
> /usr/include/openssl/kssl.h:151: parse error before "kssl_ctx_setprinc"
> /usr/include/openssl/kssl.h:151: parse error before '*' token
> /usr/include/openssl/kssl.h:153: parse error before "kssl_cget_tkt"
> /usr/include/openssl/kssl.h:153: parse error before '*' token
> /usr/include/openssl/kssl.h:155: parse error before "kssl_sget_tkt"
> /usr/include/openssl/kssl.h:155: parse error before '*' token
> /usr/include/openssl/kssl.h:157: parse error before "kssl_ctx_setkey"
> /usr/include/openssl/kssl.h:157: parse error before '*' token
> /usr/include/openssl/kssl.h:159: parse error before "context"
> /usr/include/openssl/kssl.h:160: parse error before "kssl_build_principal_2"
> /usr/include/openssl/kssl.h:160: parse error before "context"
> /usr/include/openssl/kssl.h:163: parse error before "kssl_validate_times"
> /usr/include/openssl/kssl.h:163: parse error before "atime"
> /usr/include/openssl/kssl.h:165: parse error before "kssl_check_authent"
> /usr/include/openssl/kssl.h:165: parse error before '*' token
> /usr/include/openssl/kssl.h:167: parse error before "enctype"
> In file included from mod_ssl.h:116,
>   from mod_ssl.c:65:
> /usr/include/openssl/ssl.h:909: parse error before "KSSL_CTX"
> /usr/include/openssl/ssl.h:931: parse error before '}' token
> make[5]: *** [mod_ssl.lo] Error 1
> make[4]: *** [all] Error 1
> make[3]: *** [subdirs] Error 1
> make[3]: Leaving directory `/tmp/builldinstall/apache_1.3.27/src'
> make[2]: *** [build-std] Error 2
> make[2]: Leaving directory `/tmp/builldinstall/apache_1.3.27'
> make[1]: *** [build] Error 2
> make[1]: Leaving directory `/tmp/builldinstall/apache_1.3.27'
> make: *** [apaci_httpd] Error 2
> 

-- 
+ Jon Larsen: Chief Technology Officer, Richweb, Inc.
+ Richweb.com: Providing Internet-Based Business Solutions since 1995
+ GnuPG Public Key: http://richweb.com/jlarsen.gpg
+ Business: (804) 359.2220 x 101; Mobile: (804) 307.6939



Problem configuring and making mod_perl

2003-07-16 Thread Richard Kurth
I am trying to compile mod_perl-1.28 with apache_1.3.27,openssl-0.9.7b and 
mod_ssl-2.8.12-1.3.27. When I run configure with the following and then do 
a make I get all these parse error can anybody tell me way I get this.

THIS IS WHAT I AM RUNNING TO CONFIGURE
perl Makefile.PL USE_APACI=1 EVERYTHING=1 \
DO_HTTPD=1 SSL_BASE=/usr/ \
APACHE_PREFIX=/usr/apache \
APACHE_SRC=../apache_1.3.27/src \
APACI_ARGS='--enable-module=rewrite --enable-shared=rewrite \
--sysconfdir=/etc/httpd/conf --logfiledir=/home/log --manualdir=/home/manual \
--server-uid=apache --server-gid=apache --enable-module=so 
--htdocsdir=/home/sites \
--cgidir=/home/cgi-bin --enable-module=proxy --enable-shared=proxy 
--enable-module=ssl \
--enable-shared=ssl --enable-module=access --enable-module=autoindex '

THIS IS WHAT I GET WHEN I DO A MAKE IT SEAMS TO HAVE SOMETHING TO DO WITH 
OPENSSL
gcc -c -I../.. -I/usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE 
-I../../os/unix -I../../include   -DLINUX=22 -I/usr/include/gdbm 
-DMOD_SSL=208112 -DMOD_PERL -DUSE_PERL_SSI 
-D_REENTRANT  -DTHREADS_HAVE_PIDS -DDEBUGGING -fno-strict-aliasing 
-I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 
-I/usr/include/gdbm -DUSE_HSREGEX -DEAPI -D_REENTRANT -DTHREADS_HAVE_PIDS 
-DDEBUGGING -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm `../../apaci` -fpic 
-DSHARED_MODULE -DSSL_COMPAT -DSSL_USE_SDBM -DSSL_ENGINE -I/usr//include 
-DMOD_SSL_VERSION=\"2.8.12\" mod_ssl.c && mv mod_ssl.o mod_ssl.lo
In file included from /usr/include/openssl/ssl.h:179,
 from mod_ssl.h:116,
 from mod_ssl.c:65:
/usr/include/openssl/kssl.h:72:18: krb5.h: No such file or directory
In file included from /usr/include/openssl/ssl.h:179,
 from mod_ssl.h:116,
 from mod_ssl.c:65:
/usr/include/openssl/kssl.h:132: parse error before "krb5_enctype"
/usr/include/openssl/kssl.h:134: parse error before "FAR"
/usr/include/openssl/kssl.h:135: parse error before '}' token
/usr/include/openssl/kssl.h:147: parse error before "kssl_ctx_setstring"
/usr/include/openssl/kssl.h:147: parse error before '*' token
/usr/include/openssl/kssl.h:148: parse error before '*' token
/usr/include/openssl/kssl.h:149: parse error before '*' token
/usr/include/openssl/kssl.h:149: parse error before '*' token
/usr/include/openssl/kssl.h:150: parse error before '*' token
/usr/include/openssl/kssl.h:151: parse error before "kssl_ctx_setprinc"
/usr/include/openssl/kssl.h:151: parse error before '*' token
/usr/include/openssl/kssl.h:153: parse error before "kssl_cget_tkt"
/usr/include/openssl/kssl.h:153: parse error before '*' token
/usr/include/openssl/kssl.h:155: parse error before "kssl_sget_tkt"
/usr/include/openssl/kssl.h:155: parse error before '*' token
/usr/include/openssl/kssl.h:157: parse error before "kssl_ctx_setkey"
/usr/include/openssl/kssl.h:157: parse error before '*' token
/usr/include/openssl/kssl.h:159: parse error before "context"
/usr/include/openssl/kssl.h:160: parse error before "kssl_build_principal_2"
/usr/include/openssl/kssl.h:160: parse error before "context"
/usr/include/openssl/kssl.h:163: parse error before "kssl_validate_times"
/usr/include/openssl/kssl.h:163: parse error before "atime"
/usr/include/openssl/kssl.h:165: parse error before "kssl_check_authent"
/usr/include/openssl/kssl.h:165: parse error before '*' token
/usr/include/openssl/kssl.h:167: parse error before "enctype"
In file included from mod_ssl.h:116,
 from mod_ssl.c:65:
/usr/include/openssl/ssl.h:909: parse error before "KSSL_CTX"
/usr/include/openssl/ssl.h:931: parse error before '}' token
make[5]: *** [mod_ssl.lo] Error 1
make[4]: *** [all] Error 1
make[3]: *** [subdirs] Error 1
make[3]: Leaving directory `/tmp/builldinstall/apache_1.3.27/src'
make[2]: *** [build-std] Error 2
make[2]: Leaving directory `/tmp/builldinstall/apache_1.3.27'
make[1]: *** [build] Error 2
make[1]: Leaving directory `/tmp/builldinstall/apache_1.3.27'
make: *** [apaci_httpd] Error 2



Re: pnotes and notes not working from Apache::Registry to handler

2003-07-16 Thread Mark Maunder
Found this piece of info in the archives. I'm also running 1.27. Is this
a known bug?

http://groups.yahoo.com/group/modperl/message/45472
*snip*
Subject:  notes/pnotes broke between 1.25=>1.27


So I got the advisory about the Apache servers having a security hole,
so I
decided to upgrade some servers. I've been on v1.25 for awhile, so
decided
to upgrade to 1.27 while I was at it... big mistake.

NONE of my notes/pnotes were getting thru, on the new version.
*snip*

On Wed, 2003-07-16 at 19:37, Mark Maunder wrote:
> Hi,
> 
> I'm trying to store data about a user who has authenticated in
> $r->pnotes so that a perl logging phase handler can stick the user_id in
> the db. I call $r->pnotes('keyname' => 'somevalue'); in an apache
> registry script, and then call $r->pnotes('keyname') in the logging
> handler later on during the logging phase, but am getting nothing back.
> No errors, just undef. I've tried notes too, and no luck their either.
> I'm using Apache::Request btw. I've also tried retreiving a tied hash
> using $r->pnotes() and there are no key/values in that either.
> 
> Is it possible to use pnotes to pass data from an Apache::Registry
> script to a handler? Perhaps thats the prob - didn't find anything that
> said otherwise.
> 
> Did I forget to compile apache or mod_perl with an option of some sort?
> I can't think of any other explanation. I compiled mod_perl with
> EVERYTHING=1
> 
> Thanks,
> 
> Mark.
-- 
Mark Maunder <[EMAIL PROTECTED]>
ZipTree Inc.



pnotes and notes not working from Apache::Registry to handler

2003-07-16 Thread Mark Maunder
Hi,

I'm trying to store data about a user who has authenticated in
$r->pnotes so that a perl logging phase handler can stick the user_id in
the db. I call $r->pnotes('keyname' => 'somevalue'); in an apache
registry script, and then call $r->pnotes('keyname') in the logging
handler later on during the logging phase, but am getting nothing back.
No errors, just undef. I've tried notes too, and no luck their either.
I'm using Apache::Request btw. I've also tried retreiving a tied hash
using $r->pnotes() and there are no key/values in that either.

Is it possible to use pnotes to pass data from an Apache::Registry
script to a handler? Perhaps thats the prob - didn't find anything that
said otherwise.

Did I forget to compile apache or mod_perl with an option of some sort?
I can't think of any other explanation. I compiled mod_perl with
EVERYTHING=1

Thanks,

Mark.




Re: [RFC] web-messaging application for mod_perl

2003-07-16 Thread James G Smith
Adi Fairbank <[EMAIL PROTECTED]> wrote:
>On, or in the near vicinity of Tue, 15 Jul 2003 01:47:13 -0500
>Ok, I'm sold.  Now I get the reason for not using such a generic name.
>
>In fact, I really like your suggestion Apache::App::Mercury.  If you don't mind,
>I'll use that name!  Do you mind?

Glad I could help.  As far as I'm concerned, you are free to use the
name.  I don't have any particular claim to it myself.
-- 
James Smith <[EMAIL PROTECTED]>, 979-862-3725
Texas A&M CIS Operating Systems Group, Unix


Re: [RFC] web-messaging application for mod_perl

2003-07-16 Thread Adi Fairbank
On, or in the near vicinity of Tue, 15 Jul 2003 01:47:13 -0500
James G Smith <[EMAIL PROTECTED]> has thus written:

> Adi Fairbank <[EMAIL PROTECTED]> wrote:
> >Here are the possibilities:
> >
> >  1 Apache::WebMessaging
> >  2 Apache::App::WebMessaging
> >  3 Apache::SomeOtherUniqueName (e.g. ServerMessaging, or UserMessaging, or
> >SystemMessaging)
> >
> >I personally prefer 1 or 2, so if there are no serious objections, I'll pick
> >one of those.  Let me know which you like the best.
> 
[...]
> 
> From what I can see from your description and a brief look at some of
> the code, you are doing a small portion of what web messaging can
> mean:  customer to customer, store and forward messaging.
> 
> Because you don't cover all the possibilities (and it would be
> unreasonable to expect anyone to do so), I would discourage using
> such a generic name.
> 
[...]
> 
> Having unique names like these helps in several ways.  First, they
> don't preclude others from entering the same `market,' which can be
> seen as part of the TMTOWTDI tradition in Perl.  Second, they serve
> to brand the application.  If you give a talk about Web Messaging,
> what do people expect?  We're back to the survey above.  On the other
> hand, a talk about a particular name, such as Apache::App::Mercury,
> might let people know more quickly what you are wanting to discuss.

Ok, I'm sold.  Now I get the reason for not using such a generic name.

In fact, I really like your suggestion Apache::App::Mercury.  If you don't mind,
I'll use that name!  Do you mind?

"Mercury the swift messenger of the ancient gods.

The Greek god Hermes (the Roman Mercury) was the god of translators and
interpreters. He was the most clever of the Olympian gods, and served as
messenger for all the other gods. He ruled over wealth, good fortune, commerce,
fertility, and thievery.

Among his personal favorite commercial activities was the corn trade. He was
also the god of manual arts and eloquence. As the deity of athletes, he
protected gymnasiums and stadiums."

(http://www.eso.org/outreach/eduoff/vt-2004/mt-2003/mt-mercury-mythology.html)

> Finally, you might want to change the version from 0.80pre1 to
> 0.80_01 -- CPAN might get confused by the first format.

Will do!

Cheers,
-Adi


Re: How to share subroutine

2003-07-16 Thread Ged Haywood
Hi there,

On Wed, 16 Jul 2003, Matthew Wu wrote:

>I put all my subroutine in file.pm, what I need to do such that it
> can be used by my program? I don't what location I need to put it in and
> what kind of configuration I need to modify. I am running Redhat 6.3.

At the risk of repetition... :)

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

For general Perl questions, if you are using RH6.2 you can start by
reading some of the enormous quantities of Perl documentation that
should already be on your computer.  There are also a few good books,
I guess your library should be able to get them for you but you really
need to buy a few of them if you are going to work with mod_perl.  You
will see some suggestions on the mod_perl Web site, perl.apache.org.

Please don't ask general Perl questions here.  On Linux, start with

perldoc perldoc

and 

perldoc perlfaq

and for your particular question

perldoc -f use

but you really need to do that reading.

73,
Ged.




Re: cookies

2003-07-16 Thread Dennis Stout
> > One possibility: Check the -path option. It's supposed to set it to '/'
> > by default if you dont specify it, but it doesn't. I discovered this
> > about 20 minutes ago with a similar bug. So manually specify something
> > like:
> > my $cookie = Apache::Cookie->new($r,
> > -name => 'cookiename',
> > -value => 'someval',
> > -expires => '+7d',
> > -domain => '.dontvisitus.org',
> > -path => '/',
> > );

what I have is this:

sub set_auth_cookie {
my $state = shift;

my $val = build_auth_string($state);
my $c = Apache::Cookie->new($state->{r},
-name   => 'ttms_user',
-value  => $val,
-expires=> time + 86400*30*7,
-domain => $Cookie_Domain,
-path   => '/',
);
$state->{cookie_out} = $c;
}

This is called by various other routines, and $state is a hash = {r => $r, q =
\%q }, where q is a hash = {$r->args, $r->content}.

build_auth_string is another subroutine that makes a 446bit encryption string
thats encoded with mime::base64...

I got a path.  Does that get sent to all webpages ever, or just ones underh te
/ directory?  In otherwords, does hte cookie get sent when accessing
/login.html and not when accessing /admin/view_techs.html?

All the pages on this domain are generated dynamically with a custom built
dispatch table and some awesome subroutinage.  Does that matter?  Maybe I
should read the complete netscape cookie specification :/

I know the cookie is set because it tells me when it expires and when it was
last accessed and what not on the box I browse to it with. (win2k... blah)

And the program itself is running in a Linux environment :)

Time for more warnage in the routines...

If anyone wants sourcecode to look at, email me.  It's much to big to just
post to the list.

Dennis



Re: How do you set vars via interactive startup?

2003-07-16 Thread Patrick Galbraith
Yes, if I hardcode it, fine, but not via reading  into a var, and 
then setting whatever to that var.

On 16 Jul 2003, Perrin Harkins wrote:

> On Wed, 2003-07-16 at 17:39, Patrick Galbraith wrote:
> > I'm trying to figure out how one would set vars via a startup.pl script or 
> > using PerlSections.
> 
> Is there a reason you can't just put it in a global?  The dir_config()
> stuff is really for when you want to config something specific to a
> directory or virtual host.
> 
> > I've tried things like a set method that sets a class variable of the 
> > handler I'm calling in startup.pl.. doesn't work.
> 
> Something like this doesn't work?
> 
> $Some::Package::Foo = 7;
> 
> - Perrin
> 

-- 
Patrick Galbraith
Senior Software Developer
[EMAIL PROTECTED]
[EMAIL PROTECTED] [EMAIL PROTECTED]



How to share subroutine

2003-07-16 Thread Matthew Wu
Hi:
   I put all my subroutine in file.pm, what I need to do such that it
can be used by my program? I don't what location I need to put it in and
what kind of configuration I need to modify. I am running Redhat 6.3.
Thanks.

Matthew Wu
School Loans Corp.
10780 Santa Monica Blvd, Ste 225
Los Angeles, ca 90025
Tel. 310-474-7456 ext.235
Email [EMAIL PROTECTED]



Re: cookies

2003-07-16 Thread Mark Maunder
Forgot to include the list.

-Forwarded Message-
> From: Mark Maunder <[EMAIL PROTECTED]>
> To: Dennis Stout <[EMAIL PROTECTED]>
> Subject: Re: cookies
> Date: 16 Jul 2003 14:19:27 -0700
> 
> Hi Dennis,
> 
> One possibility: Check the -path option. It's supposed to set it to '/'
> by default if you dont specify it, but it doesn't. I discovered this
> about 20 minutes ago with a similar bug. So manually specify something
> like:
> my $cookie = Apache::Cookie->new($r,
> -name => 'cookiename',
> -value => 'someval',
> -expires => '+7d',
> -domain => '.dontvisitus.org',
> -path => '/',
> );
> 
> CGI::Cookie works the same in case that's what you're using. If you have
> Mozilla, go to Preferences/Privacy/Cookies, run cookie manager and check
> the path that's being set. That's how I discovered this. 
> 
> Hope that helps.
> 
> Mark.
> 
> On Wed, 2003-07-16 at 14:13, Dennis Stout wrote:
> > Okay, so technically this isn't really "mod_perl" speific...  but the cookie
> > is being set with mod_perl and it's a huge mod_perl program being affected by
> > this:)
> > 
> > I have a cookie, the domain is set to .stout.dyndns.org (with the leading .).
> > 
> > I set the cookie just fine now (thanks to those helping me on thatr)
> > 
> > I had a problem parsing the cookie.  Added some debugging (okay, warn lines up
> > the yingyang) and after cycling through the headers and warning them out to
> > the errorlog...  I never saw any cookie info.
> > 
> > So... If the website is ttms.stout.dyndns.org shouldn't the cookie domain be
> > .stout.dyndns.org?
> > 
> > *sigh*  6 more days to finish this database.  I doubt I'll make it.
> > 
> > Dennis
> -- 
> Mark Maunder <[EMAIL PROTECTED]>
> ZipTree Inc.
-- 
Mark Maunder <[EMAIL PROTECTED]>
ZipTree Inc.



cookies

2003-07-16 Thread Dennis Stout
Okay, so technically this isn't really "mod_perl" speific...  but the cookie
is being set with mod_perl and it's a huge mod_perl program being affected by
this:)

I have a cookie, the domain is set to .stout.dyndns.org (with the leading .).

I set the cookie just fine now (thanks to those helping me on thatr)

I had a problem parsing the cookie.  Added some debugging (okay, warn lines up
the yingyang) and after cycling through the headers and warning them out to
the errorlog...  I never saw any cookie info.

So... If the website is ttms.stout.dyndns.org shouldn't the cookie domain be
.stout.dyndns.org?

*sigh*  6 more days to finish this database.  I doubt I'll make it.

Dennis



Re: How do you set vars via interactive startup?

2003-07-16 Thread Perrin Harkins
On Wed, 2003-07-16 at 17:39, Patrick Galbraith wrote:
> I'm trying to figure out how one would set vars via a startup.pl script or 
> using PerlSections.

Is there a reason you can't just put it in a global?  The dir_config()
stuff is really for when you want to config something specific to a
directory or virtual host.

> I've tried things like a set method that sets a class variable of the 
> handler I'm calling in startup.pl.. doesn't work.

Something like this doesn't work?

$Some::Package::Foo = 7;

- Perrin


Re: Double erroneous requests in POST with multipart/form-data

2003-07-16 Thread Mark Maunder
I'm running all scripts under Apache::Registry and using Apache::Request
because I'm handling file uploads. Sorry, should have included that. 

I did test this: I modified the Apache::Registry script that was being
posted to so that it didn't create an Apache::Registry request object,
but simply did a print "Content-type: text/html\n\nTesting123\n"; And I
got the same double request problem.  So it seems that it's Apache not
liking that particular request for some reason. 

Here's something wierd. I telnetted to my server's port 80 and pasted
the request, and it didn't reproduce the problem. 

Also, this doesn't happen on every POST to that script. Just that
particular one. So I kept hitting Reload and got prompted by IE whether
I wanted to retry the POST (in less technical terms) and said yes. And
every time it would kick out the errors described. Then when I left that
page and went back in, everything was fine. 

It's one of those toughies that is hard to reproduce, but my gut feel
says it's going to come up again.

On Wed, 2003-07-16 at 13:18, David Dick wrote:
> What are you using to parse the request? CGI.pm?
> 
> Mark Maunder wrote:
> 
> >This has got me stumped, any help is much appreciated:
> >
> >I'm using IE6 and mod_perl 1.27 with apache 1.3.27. I have mod_rewrite
> >and mod_proxy and mod_gzip compiled into the server, but have now
> >disabled all of them until I sort this problem out. IE generates a
> >request who's headers look like this from a sniffer's point of view:
> >
> >POST /e/myg HTTP/1.1
> >Accept: */*
> >Referer: http://ziptree.com/e/myg
> >Accept-Language: en-us
> >Content-Type: multipart/form-data;
> >boundary=---7d31a435d08
> >Accept-Encoding: gzip, deflate
> >User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows 98)
> >Host: ziptree.com
> >Content-Length: 797
> >Connection: Keep-Alive
> >Cache-Control: no-cache
> >Cookie: ztid=52616e646f6d4956aca247f49143acab646412868d6eda23;
> >ztid=52616e646f6d495616e14f825d3799273ac52995e708d08b
> >
> >
> >It's only generating on request - I've double checked that. But in my
> >access log I see this:
> >68.5.106.9 - - [16/Jul/2003:14:37:51 -0500] "POST /e/myg HTTP/1.1" 200
> >16
> >68.5.106.9 - - [16/Jul/2003:14:37:51 -0500]
> >"-7d31a435d08" 501 -
> >
> >(The two lines above have probably been split by your mail reader, but
> >they both start with the ip 68.5...)
> >
> >Also, intermittently I get "Invalid method in request" reported in the
> >error_log like this:
> >[Wed Jul 16 14:37:51 2003] [error] [client 68.5.106.9] Invalid method in
> >request -7d31a435d08
> >
> >It looks like Apache is getting confused by the boundary data and thinks
> >it's another request. It's occured to me that this could be a bug in IE
> >incorrectly specifying the boundry?
> >
> >One of the unpleasant side effects of this is that my user loses their
> >session because what Apache considers the first 'request' does not
> >contain a cookie, so we just issue a fresh session ID which overwrites
> >the previous one.
> >
> >I found these in the list archives, but no replies to either.
> >http://groups.yahoo.com/group/modperl/message/34118
> >http://groups.yahoo.com/group/modperl/message/52778
> >
> >  
> >
-- 
Mark Maunder <[EMAIL PROTECTED]>
ZipTree Inc.



How do you set vars via interactive startup?

2003-07-16 Thread Patrick Galbraith
Hi there,

I'm trying to figure out how one would set vars via a startup.pl script or 
using PerlSections. I want to set a var on startup where I'll be prompted 
and a var that I can retrieve via $r->dir_config('FOO') will get me that 
value.

I've tried endless ideas, none of which are working

The most promising is using PerlSections:


use Apache::PerlSections();

$Apache::Server::SaveConfig = 1;

if ($Apache::Server::Starting) {
print "Enter some value you don't want written down: ";
$mytmp::value = ;
chomp $mytmp::value;
} else {
print "value = '$mytmp::value'\n";
push @PerlSetVar, ["Foo" => $mytmp::value];
}


print STDERR Apache::PerlSections->dump();



This is listed on 
http://www.geocrawler.com/archives/3/182/2002/11/0/10255638/ and is an 
example by Stas Bekman. For me, it only works if I run a single httpd via 
-X (I set this in apachectl). It's something to do with the double start, 
which this example is supposed to overcome.

Other things I've tried are using "HTTPD="/usr/sbin/httpd `moduleargs`
$OPTIONS" -c $PERLSETVAR" where $PERLSETVAR is set via $2
apachectl start foopass

PERLSETVAR="PerlSetVar FOO $2"

But I'm not the best shell programmer, and somehow the shell program 
munges the PerlSetVar line. If I take the same output and run it via 
command line:

/usr/sbin/httpd -DHAVE_SETENVIF -DHAVE_CERN_META -DHAVE_EXPIRES 
-DHAVE_ACCESS -DHAVE_ASIS -DHAVE_NEGOTIATION -DHAVE_AUTH -DHAVE_IMAP 
-DHAVE_USERTRACK -DHAVE_INFO -DHAVE_SSL -DHAVE_AUTH_DBM -DHAVE_AUTH_DB 
-DHAVE_VHOST_ALIAS -DHAVE_ACTIONS -DHAVE_LOG_CONFIG -DHAVE_LOG_AGENT 
-DHAVE_MMAP_STATIC -DHAVE_PROXY -DHAVE_PERL -DHAVE_MIME_MAGIC 
-DHAVE_EXAMPLE -DHAVE_STATUS -DHAVE_PHP4 -DHAVE_LOG_REFERER -DHAVE_ALIAS 
-DHAVE_MIME -DHAVE_SPELING -DHAVE_AUTOINDEX -DHAVE_USERDIR 
-DHAVE_UNIQUE_ID -DHAVE_REWRITE -DHAVE_CGI -DHAVE_INCLUDE -DHAVE_DIR 
-DHAVE_ENV -DHAVE_AUTH_ANON -DHAVE_DIGEST -DHAVE_HEADERS  -c 'PerlSetVar 
PASS foo'

It works, but that's not a good solution.

I've tried things like a set method that sets a class variable of the 
handler I'm calling in startup.pl.. doesn't work.

So, I'm stumped. Any ideas? I'd be so greatful!

-- 
Patrick Galbraith
Senior Software Developer
[EMAIL PROTECTED]
[EMAIL PROTECTED] [EMAIL PROTECTED]



Re: Double erroneous requests in POST with multipart/form-data

2003-07-16 Thread David Dick
What are you using to parse the request? CGI.pm?

Mark Maunder wrote:

This has got me stumped, any help is much appreciated:

I'm using IE6 and mod_perl 1.27 with apache 1.3.27. I have mod_rewrite
and mod_proxy and mod_gzip compiled into the server, but have now
disabled all of them until I sort this problem out. IE generates a
request who's headers look like this from a sniffer's point of view:
POST /e/myg HTTP/1.1
Accept: */*
Referer: http://ziptree.com/e/myg
Accept-Language: en-us
Content-Type: multipart/form-data;
boundary=---7d31a435d08
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows 98)
Host: ziptree.com
Content-Length: 797
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: ztid=52616e646f6d4956aca247f49143acab646412868d6eda23;
ztid=52616e646f6d495616e14f825d3799273ac52995e708d08b
It's only generating on request - I've double checked that. But in my
access log I see this:
68.5.106.9 - - [16/Jul/2003:14:37:51 -0500] "POST /e/myg HTTP/1.1" 200
16
68.5.106.9 - - [16/Jul/2003:14:37:51 -0500]
"-7d31a435d08" 501 -
(The two lines above have probably been split by your mail reader, but
they both start with the ip 68.5...)
Also, intermittently I get "Invalid method in request" reported in the
error_log like this:
[Wed Jul 16 14:37:51 2003] [error] [client 68.5.106.9] Invalid method in
request -7d31a435d08
It looks like Apache is getting confused by the boundary data and thinks
it's another request. It's occured to me that this could be a bug in IE
incorrectly specifying the boundry?
One of the unpleasant side effects of this is that my user loses their
session because what Apache considers the first 'request' does not
contain a cookie, so we just issue a fresh session ID which overwrites
the previous one.
I found these in the list archives, but no replies to either.
http://groups.yahoo.com/group/modperl/message/34118
http://groups.yahoo.com/group/modperl/message/52778
 




Double erroneous requests in POST with multipart/form-data

2003-07-16 Thread Mark Maunder
This has got me stumped, any help is much appreciated:

I'm using IE6 and mod_perl 1.27 with apache 1.3.27. I have mod_rewrite
and mod_proxy and mod_gzip compiled into the server, but have now
disabled all of them until I sort this problem out. IE generates a
request who's headers look like this from a sniffer's point of view:

POST /e/myg HTTP/1.1
Accept: */*
Referer: http://ziptree.com/e/myg
Accept-Language: en-us
Content-Type: multipart/form-data;
boundary=---7d31a435d08
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows 98)
Host: ziptree.com
Content-Length: 797
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: ztid=52616e646f6d4956aca247f49143acab646412868d6eda23;
ztid=52616e646f6d495616e14f825d3799273ac52995e708d08b


It's only generating on request - I've double checked that. But in my
access log I see this:
68.5.106.9 - - [16/Jul/2003:14:37:51 -0500] "POST /e/myg HTTP/1.1" 200
16
68.5.106.9 - - [16/Jul/2003:14:37:51 -0500]
"-7d31a435d08" 501 -

(The two lines above have probably been split by your mail reader, but
they both start with the ip 68.5...)

Also, intermittently I get "Invalid method in request" reported in the
error_log like this:
[Wed Jul 16 14:37:51 2003] [error] [client 68.5.106.9] Invalid method in
request -7d31a435d08

It looks like Apache is getting confused by the boundary data and thinks
it's another request. It's occured to me that this could be a bug in IE
incorrectly specifying the boundry?

One of the unpleasant side effects of this is that my user loses their
session because what Apache considers the first 'request' does not
contain a cookie, so we just issue a fresh session ID which overwrites
the previous one.

I found these in the list archives, but no replies to either.
http://groups.yahoo.com/group/modperl/message/34118
http://groups.yahoo.com/group/modperl/message/52778

-- 
Mark Maunder <[EMAIL PROTECTED]>




Re: Virtual Host Logging Perl Script (mod_macro note)

2003-07-16 Thread Jez Hancock
On Wed, Jul 16, 2003 at 12:40:10PM -0700, Marc M. Adkins wrote:
> > > Right now it seems a bit silly having a separate ErrorLog line in each
> > > of the apache virtual host stubs, but as far as I am aware there isn't
> > > an easier way is there?
> >
> > You could look at mod_macro.
> mod_macro (http://www.coelho.net/mod_macro) works great for me.  I found
> that I had to make a few changes to get it to build for Apache 2.0.46.  To
My main motivation for running apache2 would be to make use of
the PerChild MPM which from what I can glean is still not working :(
This directive would save me a lot of hassles wrt running cgi scripts
(php in particular) with the euid of the script owner.  All this as I'm
tussling with mod_suphp...
-- 
Jez

http://www.munk.nu/


Re: Virtual Host Logging Perl Script

2003-07-16 Thread Jez Hancock
On Wed, Jul 16, 2003 at 07:37:21PM +0100, Ged Haywood wrote:
> Hi Jez,
> 
> On Wed, 16 Jul 2003, Jez Hancock wrote:
> 
> > [snip] We started looking at mod_log_sql: [snip]
> > but had trouble getting it to work on FreeBSD unfortunately.
> 
> I'd have thought something a bit lighter might do for this.
> 
> > Right now it seems a bit silly having a separate ErrorLog line in each
> > of the apache virtual host stubs, but as far as I am aware there isn't
> > an easier way is there?
> 
> You could look at mod_macro.
This is what I was looking for when I 'found' mod_perl (I was after
something to make repetitive vhost entries simpler to build and the
ability to do this with mp seemed great)!

Cheers.
-- 
Jez

http://www.munk.nu/


RE: Virtual Host Logging Perl Script (mod_macro note)

2003-07-16 Thread Marc M. Adkins
> > Right now it seems a bit silly having a separate ErrorLog line in each
> > of the apache virtual host stubs, but as far as I am aware there isn't
> > an easier way is there?
>
> You could look at mod_macro.

mod_macro (http://www.coelho.net/mod_macro) works great for me.  I found
that I had to make a few changes to get it to build for Apache 2.0.46.  To
wit:

110c110
< module macro_module;
---
> module AP_MODULE_DECLARE_DATA   macro_module;
810c810,811
< char * name, * where, * recursion;
---
> char * name, * recursion;
> char * where = "???";
951c952
< AP_DECLARE_DATA module macro_module = {
---
> module AP_MODULE_DECLARE_DATA macro_module = {

The preload of 'where' may be redundant, I don't remember.  I believe that
the use of AP_MODULE_DECLARE_DATA was change that I had to make or nothing
would build.  YMMV

mma



Re: Virtual Host Logging Perl Script

2003-07-16 Thread Ged Haywood
Hi Jez,

On Wed, 16 Jul 2003, Jez Hancock wrote:

> [snip] We started looking at mod_log_sql: [snip]
> but had trouble getting it to work on FreeBSD unfortunately.

I'd have thought something a bit lighter might do for this.

> Right now it seems a bit silly having a separate ErrorLog line in each
> of the apache virtual host stubs, but as far as I am aware there isn't
> an easier way is there?

You could look at mod_macro.

73,
Ged.




Re: Virtual Host Logging Perl Script

2003-07-16 Thread Jez Hancock
On Wed, Jul 16, 2003 at 12:40:06PM +0200, Guillaume Fougnies wrote:
> Wed, Jul 16, 2003 at 11:07:47AM +0100: Jez Hancock wrote:
> > I would do this but we wanted to give our users 'live' logfiles, rather
> > than making them wait until log rotation before being able to view them
> > (or did I misunderstand you?).
> 
> During my work on the ENodes project, i've developed a tiny threaded logger
> in c to manage internal logfiles (by webmaster/website/version).
> (you can rewrite it in perl with a 5.8.x built with thread...)
> 
> Perl handlers send log lines through a UNIX socket to the logger which
> is opening logfiles when needed and keeping them opened.
> It avoids the overhead of opening and locking each time the file and
> provides as many online debug logfile as you ask.
/me nods.  This would save a lot of overhead.  The only benefit of
opening a new pipe each time I suppose is that you don't need to worry
about rotation.

> The logger is launched in a 'PerlRequire' file.
> The client have a persistant connection to the logger.
> 
> If it fits your needs, you can get sources here: http://www.enodes.org
>  Server   : utils/enodes_logger/enodes_logger.c
>  Client module: enodes_core/modules/ENodes/Core/ApLog.pm
Many thanks, I'll investigate now.

Well ENodes sounds very interesting, particularly the part about
webmasters being able to test new versioning without applying changes
and the reduced httpd restart feature.  Very interesting.

Will certainly have a look at this, we're currently considering
something called webcp, a PHP project which has much potential but is
sitll unfortunately very much in beta.

Thanks!
-- 
Jez

http://www.munk.nu/


Re: Virtual Host Logging Perl Script

2003-07-16 Thread Guillaume Fougnies
Hi,

Wed, Jul 16, 2003 at 11:07:47AM +0100: Jez Hancock wrote:
> Hi Ged,
> 
> On Wed, Jul 16, 2003 at 07:06:43AM +0100, Ged Haywood wrote:
> > On Tue, 15 Jul 2003, Jez Hancock wrote:
> > > Does anyone how one could log errorlog entries in a similar manner to
> > > the script above - ie pipe the errorlog to a script which appends one
> > > copy of the error entry to a main error logfile and another copy to the
> > > virtual host's error logfile?
> > It's possible, but I don't think you really want to do it.  You would
> > be asking the server to do more than is necessary while handling each
> > request (you probably already are:).
> This was my reason for considering using mod_perl :)
> 
> > Would it not be better for example to rotate your logs frequently, and
> > to process them afterwards, off-line?  You would then have a choice of
> > doing things with the various log file analysis tools too.  If you are
> > a little bit creative in what you log, it can be simple to extract the
> > information you need for each vhost from one file.
> I would do this but we wanted to give our users 'live' logfiles, rather
> than making them wait until log rotation before being able to view them
> (or did I misunderstand you?).

During my work on the ENodes project, i've developed a tiny threaded logger
in c to manage internal logfiles (by webmaster/website/version).
(you can rewrite it in perl with a 5.8.x built with thread...)

Perl handlers send log lines through a UNIX socket to the logger which
is opening logfiles when needed and keeping them opened.
It avoids the overhead of opening and locking each time the file and
provides as many online debug logfile as you ask.
The logger is launched in a 'PerlRequire' file.
The client have a persistant connection to the logger.

If it fits your needs, you can get sources here: http://www.enodes.org
 Server : utils/enodes_logger/enodes_logger.c
 Client module  : enodes_core/modules/ENodes/Core/ApLog.pm

Cheers
--
Guillaume FOUGNIES


Re: Virtual Host Logging Perl Script

2003-07-16 Thread Jez Hancock
Hi Ged,

On Wed, Jul 16, 2003 at 07:06:43AM +0100, Ged Haywood wrote:
> On Tue, 15 Jul 2003, Jez Hancock wrote:
> > Does anyone how one could log errorlog entries in a similar manner to
> > the script above - ie pipe the errorlog to a script which appends one
> > copy of the error entry to a main error logfile and another copy to the
> > virtual host's error logfile?
> It's possible, but I don't think you really want to do it.  You would
> be asking the server to do more than is necessary while handling each
> request (you probably already are:).
This was my reason for considering using mod_perl :)

> Would it not be better for example to rotate your logs frequently, and
> to process them afterwards, off-line?  You would then have a choice of
> doing things with the various log file analysis tools too.  If you are
> a little bit creative in what you log, it can be simple to extract the
> information you need for each vhost from one file.
I would do this but we wanted to give our users 'live' logfiles, rather
than making them wait until log rotation before being able to view them
(or did I misunderstand you?).

> Have you considered using something other than flat files for logging?
We started looking at mod_log_sql:

http://www.grubbybaby.com/mod_log_sql/

but had trouble getting it to work on FreeBSD unfortunately.  The plan
was to log everything to a central MySQL (or pgsql) db table, a copy to
the vhost's logging table, same with errors (gawd knows how intense this
would be on the system).  Then when a user wanted to view their
logfiles, they'd login to their control panel and request to view only the
files they were interested in.  At this point a static copy of the log
they requested would be created in the filesystem and (optionally) a
compressed copy transferred to them in the browser.

To be honest I don't know about the above.  First of all it requires a
lot of DB transactions which would probably mean using pgsql to be safe.
Secondly there's the CGI coding that would need to be done and I don't
know how efficient or practical such a CGI script would really be.
Finally I prefer the idea of user's automatically just getting a set of
logfiles created directly to the filesystem.

Right now it seems a bit silly having a separate ErrorLog line in each
of the apache virtual host stubs, but as far as I am aware there isn't
an easier way is there?
-- 
Jez

http://www.munk.nu/


Re: Undocumented behaviour in Apache->print()?

2003-07-16 Thread Steve Hay
Stas Bekman wrote:

Steve Hay wrote:

It's only Perl 5.8 that has the special "UTF-8 flag" which the 
functions above all operate with respect to.  If a Perl variable 
contains a sequence of bytes that make up a valid UTF-8 character, 
but the string is not flagged with Perl's special flag, then Perl's 
built-in print() doesn't do this automatic conversion anyway.


Yes.

Apps wanting to handle utf will need to 'require 5.008;' as in your 
example.

IOW,

   print "Content-type: text/plain\n\n";
   $a = "\xC3\xBC";
   print $a;
retrieved from a mod_cgi server produces (via od -b / od -c):

   000 303 274
   002


yup, because you need to add utf8::decode($a); before printing $a. 
Which your version does as well. 
(Indeed.  I meant it as example of how Perl's (5.8's) print() doesn't do 
the conversion on strings that are not *flagged* as UTF-8, even when 
they make valid UTF-8.)



Perl 5.6 and older don't have the UTF-8 flag and hence don't do any 
automatic conversion via print().  Therefore, mod_perl's print() 
should not have the difference from Perl's print() that exists in 
5.8, so no change should be required.

Sure enough, looking at the "doio.c" source file in Perl 5.6.1, the 
entire chunk of code that I half-inched above is not present.


So you suggest that we copy this functionality from Perl. So if need 
to #ifdef it for 5.8.0. 
So I'll add

#if PERL_VERSION >= 8
...
#endif
around the code that I've added.



> I have attempted to shoe-horn this into mod_perl's print() method (in
> "src/modules/perl/Apache.xs").  Here's the diff against mod_perl 1.28:
> [Unfortunately, I've had to comment-out the first part of that "if"
> block, because I got an unresolved external symbol error relating to 
the
> PerlIO_isutf8() function otherwise (which may be because that function
> isn't documented in the perlapio manpage).]
>
> --- Apache.xs.orig2003-06-06 12:31:10.0 +0100
> +++ Apache.xs2003-07-15 12:20:42.0 +0100
> @@ -1119,12 +1119,25 @@
> SV *sv = sv_newmortal();
> SV *rp = ST(0);
> SV *sendh = perl_get_sv("Apache::__SendHeader", TRUE);
> +/*PerlIO *fp = PerlIO_stdout();*/
>
> if(items > 2)
> do_join(sv, &sv_no, MARK+1, SP); /* $sv = join '', 
@_[1..$#_] */
> else
> sv_setsv(sv, ST(1));
>
> +/*if (PerlIO_isutf8(fp)) {
> +if (!SvUTF8(sv))
> +sv_utf8_upgrade(sv = sv_mortalcopy(sv));
> +}
> +else*/ if (DO_UTF8(sv)) {
> +if (!sv_utf8_downgrade((sv = sv_mortalcopy(sv)), TRUE)
> +&& ckWARN_d(WARN_UTF8))
> +{
> +Perl_warner(aTHX_ packWARN(WARN_UTF8), "Wide character in 
print");
> +}
> +}
> +
> PUSHMARK(sp);
> XPUSHs(rp);
> XPUSHs(sv);
>
> Besides the problem with PerlIO_isutf8(),

mod_perl 1.x doesn't use perlio, hence you have this problem. adding:

#include "perlio.h"

should resolve it I think. 
No.  The error was "unresolved external symbol", which means that the 
compiler is happy (it evidently has pulled in perlio.h, or something 
else that declares PerlIO_isutf8() as "extern ..."), but that the linker 
couldn't find the definition of that function.

(Check: If I change "PerlIO_isutf8" to "PerlIO_isutf" (deliberate typo) 
then I get a different error - "undefined; assuming extern returning 
int" - because now no declaration has been supplied.)

Listing the symbols exported from perl58.lib shows that PerlIO_isutf8 is 
*not* one of them.  So where's the definition supposed to come from?

I'll ask about this on the perlxs mailing list, I think.



> there are other problems that
> spring to my mind straight away with this:
> - is getting the PerlIO * for STDOUT to right thing to be doing anyway?
PerlIO *fp = IoOFP(GvIOp(defoutgv)) 
Seems to work OK for me.  What's defoutgv?



> - if "items > 2", do we need to handle the UTF8-ness of each of those
> items individually before we join them?
I'm not sure, how perl handles this? 
Struggling as best as I can to read pp_print() in Perl's "pp_hot.c", it 
looks like Perl calls do_print() (which contains the UTF-8 handling that 
I've stolen) for each item in the list that is passed to it.

Considering this more, I think that it probably isn't an issue: if you 
have two variables in Perl, one of which is flagged UTF-8 and the other 
of which isn't, then when you concatenate them, the whole is "upgraded" 
to flagged UTF-8 anyway.

However, it has occurred to me that I've missed out adding the UTF-8 
handling to half of mod_perl's print() method!

The method is split into two halves:

   if (!mod_perl_sent_header(r, 0)) {
   ...
   } else {
   ...
   }
and I've only handled the first half!

The first half joins all of the items together and then calls 
send_cgi_header().  That outputs everything down to the first blank line 
(i.e. all the headers), then sets the "sent headers" flag and recurses 
on $r->print().  Next time around, we'll enter the second half, which 
simply calls write_client().

If we've already bee