cvs commit: modperl-2.0/t/response/TestModperl method.pm methodname.pm methodobj.pm

2002-05-17 Thread dougm

dougm   02/05/17 19:07:42

  Added:   t/response/TestModperl method.pm methodname.pm methodobj.pm
  Log:
  add some test for method handlers
  
  Revision  ChangesPath
  1.1  modperl-2.0/t/response/TestModperl/method.pm
  
  Index: method.pm
  ===
  package TestModperl::method;
  
  use strict;
  use warnings FATAL = 'all';
  
  use Apache::Test;
  use Apache::TestUtil;
  
  use Apache::Const -compile = 'OK';
  
  sub handler : method {
  my($class, $r) = _;
  
  plan $r, tests = 3;
  
  ok t_cmp(2, scalar _,
   '_ == 2');
  
  my $cmp_class = ref($class) || $class;
  
  ok t_cmp($cmp_class, $cmp_class,
   'handler class');
  
  ok t_cmp('/' . $cmp_class, $r-uri,
   '$r-uri eq __PACKAGE__');
  
  Apache::OK;
  }
  
  1;
  __END__
  
  
  
  1.1  modperl-2.0/t/response/TestModperl/methodname.pm
  
  Index: methodname.pm
  ===
  package TestModperl::methodname;
  
  use strict;
  use warnings FATAL = 'all';
  
  use Apache::Test;
  use Apache::TestUtil;
  
  use Apache::Const -compile = 'OK';
  
  use TestModperl::method ();
  
  sub response : method {
  TestModperl::method::handler(_);
  }
  
  1;
  __END__
  PerlResponseHandler TestModperl::methodname-response
  
  
  
  1.1  modperl-2.0/t/response/TestModperl/methodobj.pm
  
  Index: methodobj.pm
  ===
  package TestModperl::methodobj;
  
  use strict;
  use warnings FATAL = 'all';
  
  use Apache::Const -compile = 'OK';
  
  use TestModperl::method ();
  
  our ISA = qw(TestModperl::method);
  
  1;
  __END__
  PerlResponseHandler $TestModperl::MethodObj-handler
  
  
  
  



cvs commit: modperl-2.0/t/conf modperl_extra.pl

2002-05-17 Thread dougm

dougm   02/05/17 19:08:21

  Modified:t/conf   modperl_extra.pl
  Log:
  add config for modperl/methodobj test
  
  Revision  ChangesPath
  1.14  +4 -0  modperl-2.0/t/conf/modperl_extra.pl
  
  Index: modperl_extra.pl
  ===
  RCS file: /home/cvs/modperl-2.0/t/conf/modperl_extra.pl,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- modperl_extra.pl  6 Apr 2002 01:42:53 -   1.13
  +++ modperl_extra.pl  18 May 2002 02:08:21 -  1.14
   -22,6 +22,10 
   die '$ENV{MOD_PERL} not set!';
   }
   
  +#see t/modperl/methodobj
  +use TestModperl::methodobj ();
  +$TestModperl::MethodObj = bless {}, 'TestModperl::methodobj';
  +
   #see t/response/TestModperl/env.pm
   $ENV{MODPERL_EXTRA_PL} = __FILE__;
   
  
  
  



cvs commit: modperl-2.0/todo asap.txt

2002-05-17 Thread dougm

dougm   02/05/17 20:20:37

  Removed: todo asap.txt
  Log:
  these are no longer issues and anything to be added here should be in a STATUS file



compatibility problem

2002-05-17 Thread Jie Gao

Hi all,

I've been trying to get httpd-2.0.35 + mod_perl-1.99_01 work with backward
compatibility.

MY startupl.pl:

#! /usr/bin/perl
use lib '/usr/lib/perl5/site_perl/5.6.1/i386-linux/Apache2';
use strict;
use Apache::compat ();
use Apache2 ();
use My::AuthCookieHandler;
1;

and this script won't run to finish with the error:

unknown group `response' at /usr/lib/perl5/site_perl/5.6.1/My/AuthCookieHandler.pm 
line 6.
BEGIN failed--compilation aborted at 
/usr/lib/perl5/site_perl/5.6.1/My/AuthCookieHandler.pm line 6.
Compilation failed in require at ./startup.pl line 6.
BEGIN failed--compilation aborted at ./startup.pl line 6.

And this is the line in question:

use Apache::Constants qw(:common :response M_GET M_POST AUTH_REQUIRED REDIRECT);

If I take out response, it croaks at REDIRECT.

Any ideas why?

Thanks,



Jie




mod_perl and mod_cgi

2002-05-17 Thread Konstantin Yotov

Hello!

Here some details of my httpd.conf
PerlTaintcheck On
Alias /perl/ /home/httpd/perl/
PerlModule Apache::Registry
Location /perl
 SetHandler perl-script
 PerlHandler Apache::Registry
 Options ExecCGI
 allow from all
 PerlSendHeader On
/Location
PerlModule newdate::index
Location /newdate/index
 SetHandler perl-script
 PerlHandler newdate::index
/Location
my error_log
Apache/1.3.24 (Unix) mod_perl/1.26 
configured -- resuming normal operations

MaxClients 150
MaxRequestsPerChild 0

OS Linux Slackware kernel 2.2.19
CPU - 700MHz Pentium III
RAM 512MB

I be very grateful if some can get advice how tow find
out why my new scripts run twice slow than old cgi
version.
Thank you

Kosyo

__
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com



Re: Apache::DB

2002-05-17 Thread Stas Bekman

Gregory Matthews wrote:
 Hello All.
 
 I am trying to install Apache::DB and am getting the following error:
 
 +
 
   make test
 cc -c-DVERSION=\0.06\  -DXS_VERSION=\0.06\ -DPIC -fpic 
 -I/usr/libdata/perl/5.00503/mach/CORE  DB.c
 In file included from /usr/include/sys/time.h:289,
  from /usr/include/sys/stat.h:50,
  from /usr/include/sys/mount.h:44,
  from /usr/libdata/perl/5.00503/mach/CORE/perl.h:376,
  from DB.xs:2:
 /usr/include/time.h:2: syntax error before `1989'
 /usr/include/time.h:26: empty character constant
 /usr/include/time.h:32: syntax error before `PROFITS'
 /usr/include/time.h:115: syntax error before `}'
 *** Error code 1

You have a corrupted /usr/include/time.h, reinstall the package that it 
comes with or simply borrow this file from some other machine.

before you try to build Apache::DB try to build test.c with the contents:

#include time.h
int main(void){return 0;}

and then compile it:

% cc test.c

once it works move onto Apache::DB
__
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




Dynamically Changing the Document Root

2002-05-17 Thread simran

Hi All, 

We are currently building a mod_perl application that has a content
management component in it. 

After editing a page, we want to be able to give people a 'Preview your
site' ability where they are view a 'preview/staged' mode of their site.

The 'staged' version of their site is stored in a different directory,
and if i could just changed the document_root dynamically, most(?) of
our issues would be over. 

Is there a way to do this? The documentation does not have any reference
to be able to change the document root (just get it via
$r-document_root). 

simran.

ps: We are intending on having something like where when people go to
http://www.testsite.com/preview/contactus/index.html we strip out
the /preview from the URL (i assume i can change this via
$r-uri... and change the document root from 
/home/www/testsite.com/current to /home/www/testsite.com/stage



RE: Force a 404 error?

2002-05-17 Thread Jonathan M. Hollin

See Chapter 4, Handling Errors, in the Eagle book.

Great Thomas, I have a working handler now.  Thanks very much to Thomas
and everyone else who replied with suggestions.


Jonathan M. Hollin - WYPUG Co-ordinator

West Yorkshire Perl User Group
http://wypug.pm.org/
http://wypug.digital-word.com/




Re: Dynamically Changing the Document Root

2002-05-17 Thread Marc Slagle

 The 'staged' version of their site is stored in a different directory,
 and if i could just changed the document_root dynamically, most(?) of
 our issues would be over.

 Is there a way to do this? The documentation does not have any reference
 to be able to change the document root (just get it via
 $r-document_root).

You might want to use a translation handler (Chapter 7 of the Eagle book.)

We did something similar to this, where if a browser asks for an index page
it forces apache to use a db file to get its filename/path.  You could check
the incoming path for the Preview mode and set $r-filename.

Something like:

my $uri=$r-parsed_uri;
my $Path=$uri-path;

if ($Path =~ /Preview/)
{
$r-filename($Path_to_file_on_filesystem);
return OK;
}

return DECLINED;

The above might not exactly do it, but its just a rough example.  The return
OK will make apache skip its own URL to file translation stuff, where return
DECLINED should let apache continue as normal (reading httpd.conf for
finding paths, etc.)

Marc Slagle







Re: Dynamically Changing the Document Root

2002-05-17 Thread Geoffrey Young

 
 Is there a way to do this? The documentation does not have any reference
 to be able to change the document root (just get it via
 $r-document_root). 


see recipe 4.3 in the cookbook for a description of $r-document_root 
and the perils involved.  the minimum you should be aware of is that 
DocumentRoot is a server attribute, not a request attribute, so 
changing it affects all future requests to the child process unless 
you set it back.

the code we use as an example is here

   http://www.modperlcookbook.org/code/ch04/Cookbook/Userdir.pm

and all of chapter 4 can be viewed online here

   http://www.webreference.com/programming/perl/cookbook/

HTH

--Geoff




Re: Apache::DB

2002-05-17 Thread Per Einar Ellefsen

At 06:41 17.05.2002, Gregory Matthews wrote:
Hello All.

I am trying to install Apache::DB and am getting the following error:

+

  make test
cc -c-DVERSION=\0.06\  -DXS_VERSION=\0.06\ -DPIC -fpic 
-I/usr/libdata/perl/5.00503/mach/CORE  DB.c
In file included from /usr/include/sys/time.h:289,
  from /usr/include/sys/stat.h:50,
  from /usr/include/sys/mount.h:44,
  from /usr/libdata/perl/5.00503/mach/CORE/perl.h:376,
  from DB.xs:2:
/usr/include/time.h:2: syntax error before `1989'
/usr/include/time.h:26: empty character constant
/usr/include/time.h:32: syntax error before `PROFITS'
/usr/include/time.h:115: syntax error before `}'
*** Error code 1

Stop in /usr/home/goxcom/Perl_Modules/Apache-DB-0.06/Apache-DB-0.06.

+

Any ideas? I downloaded from CPAN, and also tried to install directly from 
my shell.

This seems unrelated to Apache::DB. What is your 'cc'? There must be some 
problem with time.h or the way your compiled interprets it. You might want 
to ask an OS-specific mailing list about this.


-- 
Per Einar Ellefsen
[EMAIL PROTECTED]





Re: Dynamically Changing the Document Root

2002-05-17 Thread Per Einar Ellefsen

At 09:59 17.05.2002, simran wrote:
ps: We are intending on having something like where when people go to
 http://www.testsite.com/preview/contactus/index.html we strip out
 the /preview from the URL (i assume i can change this via
 $r-uri... and change the document root from
 /home/www/testsite.com/current to /home/www/testsite.com/stage

You can't change the document root, but you don't necessarily need to 
either. You could set up an alias in httpd.conf
VirtualHost foo
Alias /preview/ /home/www/testsite.com/stage/
:
/VirtualHost

Or you could use a generic URI translation handler which would do the URI 
translation, running in /preview
Location /preview
PerlTransHandler My::Foo
/Location
then My::Foo maps the URI to a filename or something like that.


-- 
Per Einar Ellefsen
[EMAIL PROTECTED]





modperl idle timeout....

2002-05-17 Thread Jim Morrison [Mailinglists]

Guys,

I am currently using mod_perl  XML::Xalan.. which is going well.. (For
those of you who answered questions of mine about memory usage, I found some
big memory leaks in my code... Doh!... Much better now... )

However, because it's only a little box, and because Xalan (and therefore
mod_perl) is not used 24x7 I have set up and apache graceful restart on a
crontab, so that mod_perl gets flushed out of use every hour... which keeps
our mem usage down, and stops me having lots of big httpd's lying around
that don't need to have Perl compiled into them..

Anyhow...  I was wondering... is there a simple way to set up a sort of
idle timeout to get each single httpd to restart itself if two conditions
are met:
 - 1 - It has compiled mod_perl
 - 2 - The mod_perl aliases have not been accessed for 'x' minutes...

What do you guys recon... is crontabbing a restart easier.. is it ill
advised?  (Ofcourse the restart runs even when you are using mod_perl..
which doesn't really help anyone.. cos then it has to go through the restart
lag.. )


Oh well... would love to hear your thoughts,

All the best,


Jimbo



Jim Morrison
_
Technology  Development Partner
Isotope LLP
9, 2 Laura Place
Bath, Somerset
United Kingdom




Re: modperl idle timeout....

2002-05-17 Thread Stas Bekman

Jim Morrison [Mailinglists] wrote:

  Anyhow...  I was wondering... is there a simple way to set up a sort
  of idle timeout to get each single httpd to restart itself if two
  conditions are met: - 1 - It has compiled mod_perl - 2 - The mod_perl
  aliases have not been accessed for 'x' minutes...
 
  What do you guys recon... is crontabbing a restart easier.. is it ill
   advised?  (Ofcourse the restart runs even when you are using
  mod_perl.. which doesn't really help anyone.. cos then it has to go
  through the restart lag.. )
 
 
  Oh well... would love to hear your thoughts,

You can do this only with an external process, since child processes 
cannot communicate with each other. Though you have the scoreboard which 
is probably what you want.

Look at Apache::Watchdog::RunAway, you can adjust it easily to do what
you want. Though you pay the price of enabling the scoreboard extended 
updates on the live system, which adds a slight overhead to each 
request's response times.

But using the crontab seems much simpler to me.

__
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




[OT] Refs don't work, like I want

2002-05-17 Thread Viljo Marrandi

Hello,

Sorry about non mod_perl question, but as I'm subscribed to this list and
I know I can get help from here, I ask my question here.

Can anyone tell me, what's wrong with this piece of code:

$vars-{'key2'} = value of second key;
$vars = {
xxx = AAA,
yyy = BBB,
zzz = CCC,
};
$vars-{'key1'} = value of first key;

foreach $a ( keys %{$vars} ) {
   print $a = $vars-{$a}\n;
}


Problem is, that value of key2 is lost after I set values to xxx, yyy and
zzz, but key1 is ok. I searched through perlref, perldsc manpages, but
didn't find anything similar (maybe that's the problem?).

Any help is welcome.

Rgds,
Viljo




Re: [OT] Refs don't work, like I want

2002-05-17 Thread F . Xavier Noria

On Fri, 17 May 2002 17:10:53 +0300 (EEST)
Viljo Marrandi [EMAIL PROTECTED] wrote:

: $vars-{'key2'} = value of second key;

The hash $vars points to has a key named key2.

: $vars = {
: xxx = AAA,
: yyy = BBB,
: zzz = CCC,
: };

Now you change the reference stored in $var. It points to an entirely
new hash, whose keys are xxx, yyy and zzz.

: $vars-{'key1'} = value of first key;

Here you add the key key1 to the hash $vars points to.

: Problem is, that value of key2 is lost after I set values to xxx, yyy and
: zzz, but key1 is ok.

$vars contains a reference to a hash that has nothing to do with the
first one, you didn't create a key named key2 in that hash.

-- fxn



Re: [OT] Refs don't work, like I want

2002-05-17 Thread Stas Bekman

Viljo Marrandi wrote:

 Sorry about non mod_perl question, but as I'm subscribed to this list and
 I know I can get help from here, I ask my question here.

Please do NOT do that in the future. This is the *modperl* list. There 
are hundreds of perl lists which will gladly help you out. perlmonks.org 
is one of these places.

Folks, please refrain to reply to this kind of questions, but instead 
send those who ask to the other resources, *without* answering the 
question, no matter how simple it is. Don't encourage people to be 
lazier than they are already.

I know I don't sound nice, but we try hard to keep a low Sound to Noise 
Ratio here. Please help to keep this list useful to those who seek 
mod_perl help and clean of noise for those who can help.

p.s. I usually don't bash this kind of posts, but this one was saying:

   as I'm subscribed to this list and
   I know I can get help from here,
   I ask my question here.

it's not very nice of you, Viljo. Please subscribe to other relevant 
lists and ask the questions there if they don't belong here.

__
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: [OT] Refs don't work, like I want

2002-05-17 Thread Stas Bekman

Stas Bekman wrote:

 I know I don't sound nice, but we try hard to keep a low Sound to Noise 
 Ratio here.

of course I meant a *high* Sound to Noise Ratio. the heat and humidity 
shows :)

p.s. sorry for adding to the noise. back to work on adding more sound.

__
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: [OT] Refs don't work, like I want

2002-05-17 Thread Jon Robison

In support of F. Xavier Noria, and in simpler terms - your $vars = {
. } overwrote your previous assignment of $vars-{'key2'}.

Perhaps you could have done:

my $var = {};
$var-{'key2'} = some value;
my @args = qw/ XXX YYY ZZZ /;
my @vals = qw/ AAA BBB CCC /;
my $i;
for ($i =0; $i  scalar(@args); $i++) {
  $vars-{$args[$i]} = $vals[$i];
}
$var-{'key1'} = some other value;

This would not have overwritten the $var-{'key2'} assignment.

--Jon Robison


F.Xavier Noria wrote:
 
 On Fri, 17 May 2002 17:10:53 +0300 (EEST)
 Viljo Marrandi [EMAIL PROTECTED] wrote:
 
 : $vars-{'key2'} = value of second key;
 
 The hash $vars points to has a key named key2.
 
 : $vars = {
 : xxx = AAA,
 : yyy = BBB,
 : zzz = CCC,
 : };
 
 Now you change the reference stored in $var. It points to an entirely
 new hash, whose keys are xxx, yyy and zzz.
 
 : $vars-{'key1'} = value of first key;
 
 Here you add the key key1 to the hash $vars points to.
 
 : Problem is, that value of key2 is lost after I set values to xxx, yyy and
 : zzz, but key1 is ok.
 
 $vars contains a reference to a hash that has nothing to do with the
 first one, you didn't create a key named key2 in that hash.
 
 -- fxn



Re: [2.x] Windows interpreter-wide locking due to modules?

2002-05-17 Thread Randy Kobes

On Thu, 16 May 2002, James Luberda wrote:

 I have installed Randy Kobes' 5-10-2002 Apache-2/modperl-2 Win32
 binaries on a Win2k Professional P3 uniprocessor development machine. I
 have left all of the startup.pl script as is. Everything works
 great--however, with some scripts I seem to still suffer from 1.3-style
 locks on the perl interpeter that prevent some other scripts from being
 served until a given dynamic request completes. I've poked around a bit
 and found that simple scripts (ones not using modules) will still be
 executed while another long-running process is executing (thus
 multithreading properly)--so I'm figuring it's probably a module issue
 (or I'm simply confused). The two modules I'm running predominantly are
 DBI 1.14 (with DBD::DB2 .74) and CGI 2.74, and I have verified that two
 scripts running simultaneously with these two modules will result in one
 blocking until the other completes.

 Any/all ideas most welcome--and my sincerest thanks to Randy for his 1.3
 and 2.0 binaries and other incredibly helpful docs/builds/info/etc.

Thanks :) ... Is this a registry script you're finding the
blocking with, or within your own custom handler? I just tried
the following script (Win2000, ActivePerl 631):
===
use strict;
use DBI;
use CGI qw(:all);
print header, start_html, h3('TEST'), 'UL';
my $dbh = DBI-connect('DBI:mysql:what', 'user', 'passwd',
  {RaiseError = 1, PrintError = 1});
my $query = SELECT x FROM y WHERE z LIKE 'ABC%';
my $sth = $dbh-prepare($query);
$sth-execute;
while (my $name = $sth-fetchrow_array) {
   print LI$name/LI\n;
}
$sth-finish;
sleep(10);
print /UL, end_html;
===
under ModPerl::Registry, with the following directives:
===
Location /perl
   SetHandler perl-script
   PerlResponseHandler ModPerl::Registry
   Options +ExecCGI
   PerlOptions +GlobalRequest
   PerlOptions +ParseHeaders
/Location
===
and didn't see any blocking ... Does an equivalent of the above
work for you?

If not, you might try the most recent Apache2 stuff (May 13) -
Doug made a whole bunch of enhancements to the Win32 side of
mod_perl-2 recently, and perhaps one of those is related to this.

Are you using Apache::DBI? If so, try disabling it and seeing
if that helps.

best regards,
randy




Re: compatibility problem

2002-05-17 Thread Peter Rothermel

You'll find a few other issues with AuthCookie and mod_perl-1.9.9_01
beyond the REDIRECT constant.  Here's a quick summary:

1) move all the $r-connection-user() calls to $r-user() calls
2) change all the err_header_out() calls to err_headers_out() calls.
 $r-err_headers_out-{'Pragma'} = no-cache;
---
 $r-err_header_out(Pragma = no-cache);

This is the bulk of the changes that I did to get things going. I'm
going to send my in to the maintainer of the Module as soon as I
get some help with method handles. This module makes use of
the technique of derived method handlers. I have been able to get
a regular, much less a derived, method handler working in mod_perl1.99.
As a temporary hack I hacked the module code to be a non-method handler.

good luck,
-pete


Stas Bekman wrote:

 Jie Gao wrote:
  Hi all,
 
  I've been trying to get httpd-2.0.35 + mod_perl-1.99_01 work with backward
  compatibility.
 
  MY startupl.pl:
 
  #! /usr/bin/perl
  use lib '/usr/lib/perl5/site_perl/5.6.1/i386-linux/Apache2';
  use strict;
  use Apache::compat ();
  use Apache2 ();
  use My::AuthCookieHandler;
  1;
 
  and this script won't run to finish with the error:
 
  unknown group `response' at /usr/lib/perl5/site_perl/5.6.1/My/AuthCookieHandler.pm 
line 6.
  BEGIN failed--compilation aborted at 
/usr/lib/perl5/site_perl/5.6.1/My/AuthCookieHandler.pm line 6.
  Compilation failed in require at ./startup.pl line 6.
  BEGIN failed--compilation aborted at ./startup.pl line 6.
 
  And this is the line in question:
 
  use Apache::Constants qw(:common :response M_GET M_POST AUTH_REQUIRED REDIRECT);
 
  If I take out response, it croaks at REDIRECT.
 
  Any ideas why?

 Yes, it's not fully compatible :( in 2.0 we take all the Constants from
 APR and Apache, and they have changed. I guess we can manually do the
 adjustments in compat.pm. Currently there is no group :response in
 Apache::Const, these mainly reside in the new group :http and all the
 codes start with HTTP_

 For now try to replace
 REDIRECT with HTTP_TEMPORARY_REDIRECT
 and whatever constants you need from :response by looking them up in
 xs/ModPerl/Const/modperl_constants.c (which is autogenerated when you
 build mod_perl).

 We will discuss this issue at the dev list and the compat docs will be
 updated appropriately.

 __
 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: Apache::DB

2002-05-17 Thread Stas Bekman

[please don't forget that to CC the list!]

Gregory Matthews wrote:
 Stas:
 
 Thanks for your reply on my issue in the Mod_Perl list.
 
 Excuse my ignorance, but how do I do the following:
 
 before you try to build Apache::DB try to build test.c with the contents:
 #include time.h
 int main(void){return 0;}
 and then compile it:
 % cc test.c
 
 If you could point me in the right direction, I can figure it out!  I am 
 running FreeBSD.
 
 Thanks.
 
 Gregory
 

create a file named test.c, put inside:

include time.h
int main(void){return 0;}

now you need to compile it with:

cc test.c

if this doesn't work (i.e. you get compilation errors, you have to ask 
for assistance on the FreeBSD mailing list(s) or elsewhere, since your 
problem has nothing to do with mod_perl.


__
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




Reloading Library Files

2002-05-17 Thread Ted Prah

Hi,

I am new to mod_perl and am having problems seeing the
changes made to library files.  Must I restart the server every
time I change a library file in order to see my changes?  My
test code and environment is below.


z.pl - test script which calls entry_point in z_lib.pl
---
#!/usr/local/bin/perl
use strict;

require '/home/cgi-bin/z_lib.pl';

entry_point();
---


z_lib.pl
--
#!/usr/local/bin/perl
use strict;

sub entry_point {

my $r = Apache-request;
$r-content_type('text/html');
$r-send_http_header;

print HERE 1;
#print   HERE 2;

}

1;
--


My Test Procedure:

1.)  Start server (w/ -X option)
2.)  Run z.pl via browser - output is HERE 1
3.)  Uncomment out second print statement in z_lib.pl
4.)  Reload z.pl via browser - output is HERE 1
 I would expect it to display the output of
 the second print statement, but it does not.
5.)  Re-start server
6.)  Run z.pl via browser - output is HERE 1  HERE 2


If I deliberately put an error in z_lib.pl and reload z.pl, I receive
an error message.  So, it appears that the library file z_lib.pl is
getting reloaded.  But why don't my changes show up?  Also,
here is the output in the error_log that displays Apache::StatINC
messages

Apache::StatINC: process 21891 reloading /home/cgi-bin/z_lib.pl.
Apache::StatINC::handler('Apache=SCALAR(0x211220)') called at /dev/null
line 0  eval {...} called at /dev/null line 0


I have extended INC by using use lib .. in the startup file.  I
have read through the mod_perl guide at http://apache.perl.org/, but
am unable to resolve this problem.  Should I replace the 'require's
with 'do's in development and then switch back to requires when
moving to production?


My Environment:
perl version:  5.6.1
mod_perl version:  1.26
apache version:  1.3.24
OS:  Solaris 2.8



from httpd.conf

PerlWarn On
PerlModule Apache::StatINC
PerlRequire /httpd/conf/startup.pl

Alias /cgi-bin/ /home/cgi-bin/

PerlModule Apache::Registry
Location /cgi-bin
SetHandler  perl-script
PerlHandler Apache::Registry
Options +ExecCGI
allow from all
PerlSendHeader On
PerlInitHandler Apache::StatINC
PerlSetVar StatINC_Debug 1
/Location




startup.pl
---
use strict;

# Extend INC if needed
use lib qw(/home/cgi-bin);

# Make sure we are in a sane environment.
$ENV{MOD_PERL} or die not running under mod_perl!;

# Don't include the name of the virtual host in the package name
$Apache::Registry::NameWithVirtualHost = 0;

# Load Perl modules of your choice here
# This code is interpreted *once* when the server starts
use Apache::DBI ();
use DBI ();

# Tell me more about warnings
use Carp ();
$SIG{__WARN__} = \Carp::cluck;

1;
---



Thanks for any help you can provide,

Ted




Re: Apache::DB

2002-05-17 Thread Stas Bekman

Gregory Matthews wrote:
 Stas:
 
 Out of curiosity, what do YOU use to debug perl running under mod_perl?

Apache::DB

__
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: Reloading Library Files

2002-05-17 Thread Drew Taylor

Take a look at Apache::Reload or Apache::StatINC. Reload is more flexible, 
but StatINC has been around a little longer. Both have worked well for me. 
But be sure that you don't use these modules on a production server. :-)

httpd.conf
==
PerlInitHandler Apache::Reload

Drew

At 01:38 PM 5/17/02 -0400, Ted Prah wrote:
Hi,

I am new to mod_perl and am having problems seeing the
changes made to library files.  Must I restart the server every
time I change a library file in order to see my changes?  My
test code and environment is below.

==
Drew Taylor  |  Freelance web development using
http://www.drewtaylor.com/   |  perl/mod_perl/MySQL/postgresql/DBI
mailto:[EMAIL PROTECTED]   |  Email jobs at drewtaylor.com
--
Speakeasy.net: A DSL provider with a clue. Sign up today.
http://www.speakeasy.net/refer/29655
==




Re: Reloading Library Files

2002-05-17 Thread Ted Prah

I have tried Apache::Reload as well, but I get the same results.

Ted

Drew Taylor wrote:

 Take a look at Apache::Reload or Apache::StatINC. Reload is more flexible,
 but StatINC has been around a little longer. Both have worked well for me.
 But be sure that you don't use these modules on a production server. :-)

 httpd.conf
 ==
 PerlInitHandler Apache::Reload

 Drew

 At 01:38 PM 5/17/02 -0400, Ted Prah wrote:
 Hi,
 
 I am new to mod_perl and am having problems seeing the
 changes made to library files.  Must I restart the server every
 time I change a library file in order to see my changes?  My
 test code and environment is below.

 ==
 Drew Taylor  |  Freelance web development using
 http://www.drewtaylor.com/   |  perl/mod_perl/MySQL/postgresql/DBI
 mailto:[EMAIL PROTECTED]   |  Email jobs at drewtaylor.com
 --
 Speakeasy.net: A DSL provider with a clue. Sign up today.
 http://www.speakeasy.net/refer/29655
 ==




Re: Reloading Library Files

2002-05-17 Thread Drew Taylor

Have you tried moving the PerlInitHandler  PerlSetVar up and out of the 
Location directive, making it global for the server? I'm not sure that 
would fix it, but it's worth a try.

Drew

At 02:37 PM 5/17/02 -0400, Ted Prah wrote:
I have tried Apache::Reload as well, but I get the same results.

Ted

Drew Taylor wrote:

  Take a look at Apache::Reload or Apache::StatINC. Reload is more flexible,
  but StatINC has been around a little longer. Both have worked well for me.
  But be sure that you don't use these modules on a production server. :-)
 
  httpd.conf
  ==
  PerlInitHandler Apache::Reload
 
  Drew
 
  At 01:38 PM 5/17/02 -0400, Ted Prah wrote:
  Hi,
  
  I am new to mod_perl and am having problems seeing the
  changes made to library files.  Must I restart the server every
  time I change a library file in order to see my changes?  My
  test code and environment is below.

==
Drew Taylor  |  Freelance web development using
http://www.drewtaylor.com/   |  perl/mod_perl/MySQL/postgresql/DBI
mailto:[EMAIL PROTECTED]   |  Email jobs at drewtaylor.com
--
Speakeasy.net: A DSL provider with a clue. Sign up today.
http://www.speakeasy.net/refer/29655
==




Re: Reloading Library Files

2002-05-17 Thread Ted Prah

Thanks Drew, I tried that, but it did not work.

Ted

Drew Taylor wrote:

 Have you tried moving the PerlInitHandler  PerlSetVar up and out of the
 Location directive, making it global for the server? I'm not sure that
 would fix it, but it's worth a try.

 Drew

 At 02:37 PM 5/17/02 -0400, Ted Prah wrote:
 I have tried Apache::Reload as well, but I get the same results.
 
 Ted
 
 Drew Taylor wrote:
 
   Take a look at Apache::Reload or Apache::StatINC. Reload is more flexible,
   but StatINC has been around a little longer. Both have worked well for me.
   But be sure that you don't use these modules on a production server. :-)
  
   httpd.conf
   ==
   PerlInitHandler Apache::Reload
  
   Drew
  
   At 01:38 PM 5/17/02 -0400, Ted Prah wrote:
   Hi,
   
   I am new to mod_perl and am having problems seeing the
   changes made to library files.  Must I restart the server every
   time I change a library file in order to see my changes?  My
   test code and environment is below.

 ==
 Drew Taylor  |  Freelance web development using
 http://www.drewtaylor.com/   |  perl/mod_perl/MySQL/postgresql/DBI
 mailto:[EMAIL PROTECTED]   |  Email jobs at drewtaylor.com
 --
 Speakeasy.net: A DSL provider with a clue. Sign up today.
 http://www.speakeasy.net/refer/29655
 ==

--
Ted Prah
NetCasters, Inc.
Phone:  978.887.2100 x44
Fax:  978.887.6750
[EMAIL PROTECTED]





Re: [OT] Refs don't work, like I want

2002-05-17 Thread Per Einar Ellefsen

At 16:10 17.05.2002, Viljo Marrandi wrote:
Hello,

Sorry about non mod_perl question, but as I'm subscribed to this list and
I know I can get help from here, I ask my question here.

Can anyone tell me, what's wrong with this piece of code:

$vars-{'key2'} = value of second key;
$vars = {
 xxx = AAA,
 yyy = BBB,
 zzz = CCC,
};
$vars-{'key1'} = value of first key;

foreach $a ( keys %{$vars} ) {
print $a = $vars-{$a}\n;
}


Problem is, that value of key2 is lost after I set values to xxx, yyy and
zzz, but key1 is ok. I searched through perlref, perldsc manpages, but
didn't find anything similar (maybe that's the problem?).

Reea OT, but ok :)

You're effectively re-setting your variable here. What you do above is, if 
we consider simple scalars, the same as:
$vars = Foo1;
$vars = Foo2;

What will be the value of $vars? Foo2 of course.

What are your solutions? The easiest would maybe be to do this:
@{$vars}{qw/xxx yyy zzz/} = qw/AAA BBB CCC/;

Or
$vars-{xxx} = 'AAA', etc


-- 
Per Einar Ellefsen
[EMAIL PROTECTED]





Generating dynamic VirtualHost and Location directives

2002-05-17 Thread Mathieu Jondet

Hi all,
I'm actually working on a application for generating dynamic virtual
host and locations in these virtual host from a web interface.
The purpose of this application is to give a non-administrator the
possibility of adding on the fly virtualhost to a webserver without
modifying httpd.conf and to add locations to a specific virtualhost.

So far I've manage to do the part of generating the httpd.conf file
through Perl sections which takes all the necessary data from a MySQL
server. The tricky part is to update the server configuration without
having to restart the server. I've looked on the web and in the archives
of the
mailing list and found things about using the PerlInitHandler. I didn't
tested it but I'm quite worried about the overhead of connecting to the
database
to check modification times of the virtual host entries.

So my question would be : what will be the more efficient way to
update my configuration against a database ?

Thanks for answers and ideas,

Regards,
Mathieu

ps: my configuration : apache 1.3.24/mod_perl 1.26 on a linux box.





Generating dynamic VirtualHost and Location directives and reloading Apache configuration

2002-05-17 Thread Mathieu Jondet

Hi all,
I'm actually working on a application for generating dynamic virtual

host and locations in these virtual host from a web interface.
The purpose of this application is to give a non-administrator the
possibility of adding on the fly virtualhost to a webserver without
modifying httpd.conf and to add locations to a specific virtualhost.

So far I've manage to do the part of generating the httpd.conf file
through Perl sections which takes all the necessary data from a MySQL
server. The tricky part is to update the server configuration without
having to restart the server.
I've looked on the web and in the archives of the mailing list and
found things about
using the PerlInitHandler and sending Apache a SIGUSR1 signal.
I don't know how to do this as I'm quite new to the mod_perl
programming. I would
also want to know if it won't be too slow to check the modifications
times of the
config in the database at each client request.

Do you have any other idea of doing this ?
What will be the more efficient way to update my configuration against a
database ?

Thanks for answers and ideas,

Regards,
Mathieu

ps: my configuration : apache 1.3.24/mod_perl 1.26 on a linux box.




Re: Force a 404 error?

2002-05-17 Thread Helios de Creisquer

On Thu, May 16, 2002 at 11:40:49AM +0100, Jonathan M. Hollin wrote:
 Hi JAPHs,
 
 Is it possible to force a 404-error from within a mod_perl CGI?
 
 I am working on my CMS and I want to generate a 404 if the user hacks
 the URI in a certain way: i.e, if the use passes a value in the URI that
 does reference a database record.  I can (and have) trapped such an
 event and thus I can display the appropriate Not found warning by
 using a CGI.pm redirect to my 404 page, but using redirect obviously
 updates the URL (as displayed on the browsers address line) to that of
 the 404 page, whereas I want the URL to continue to display the users
 request.
 
 Can I do this?

See:

http://archive.covalent.net/modperl/2001/04/0088.xml

Cheers,
-- 
   Helios de Creisquer  [EMAIL PROTECTED]
http://www.tuxfamily.org/[EMAIL PROTECTED]
http://www.vhffs.org/  +33 (0)6 70 71 20 29  [EMAIL PROTECTED]
http://www.gnu.org/[EMAIL PROTECTED]
GPG(1024D/96EB1C44): FB11 8B80 4D86 D9C2 DE0C 11D7 2FA8 A5CC 96EB 1C44