Module problem

2003-08-28 Thread Jesper Nøhr
Hey list.

I have a problem with mod_perl being implemented in httpd.conf in apache.
I'm using it to load some virtual hosts out of a MySQL database.
It works very well, but now I want to make it into a module, so I don't 
have all sort of code in my configuration, plus make it available for 
others.
So I copy my code into a module I created, and I do all that use 
vhost::loader; etc.
The problem is, I use the directive %VirtualHost, and that works fine in 
httpd.conf, but that variable does not exist in the module.
How do I transfer the variable to the module, so it can read/write to it?

Thanks in advance.

--
Mvh. / Best Regards,
Jesper Nøhr - decius <[EMAIL PROTECTED]>
Holstebro, Denmark -- http://printf.dk
Systems Administrator, Coder, Geek.
--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: Please help newbie with Module problem.

2003-07-02 Thread Dennis Stout
You can send me- er, the "Help Dennis Move out of Alaska" charity money by
giving your credit card number to

*grin*

Thank you, I'm sure Randy would agree when I say it's nice to be appreciated
:)

Dennis Stout
S.T.O.U.T. = Synthetic Technician Optimized for Ultimate Troublshooting
- Original Message - 
From: "Matt Corbett" <[EMAIL PROTECTED]>
To: "'Dennis Stout'" <[EMAIL PROTECTED]>; "'Randy Kobes'"
<[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Wednesday, July 02, 2003 11 55
Subject: RE: Please help newbie with Module problem.


> Dennis and Randy and others on the list that gave advice,
> Thank you so much for both your help. This has sorted out the problem. I
> copied the *.pl files to the c:\apache\perl directory and before I made
> the change to the httpd.conf file I tried it tham again and it's
> perfect. If either or both of you can recommend a good charity I will
> make a small donation for your time. Again thanks
>
> Matt
>
>
> -Original Message-
> From: Dennis Stout [mailto:[EMAIL PROTECTED]
> Sent: 02 July 2003 19:28
> To: Matt Corbett
> Subject: Re: Please help newbie with Module problem.
>
>
> > I don't have a PerlHandler set in my httpd.conf.
> >
> > How should I set this.
>
> Edit whatever form of an httpd.conf file that Apache has under Win32
> (should be hte same, location I don't know).
>
> mv the script out of the cgi-bin and into somewhere else, like
> C:/Apache/perl
>
> Let's say the name is RequestHandler.pm
>
> In httpd, add this line:
>
> 
> 
> SetHandler perl-script
> PerlHandler RequestHandler
> 
> 
>
> Restart Apache, and any access to blah.yourdomain.whatever/ should get
> trapped in there.
>
> You may need to add the other standard apache directives to that, like
> ServerName blah.yourdomain.whatever and so on, but probably not.
>
> >
> > I think we are so close I can almost feel it.
>
> Yes, we are.  The code I sent you is hte core of hte project I'm
> currently programming, which includes an entire dispatch table.
>
> Now if only I could get it to grab the right friggin string from a SQL
> server to authenticate >:|
>
> >
> >
> > -Original Message-
> > From: Dennis Stout [mailto:[EMAIL PROTECTED]
> > Sent: 02 July 2003 18:57
> > To: Matt Corbett
> > Subject: Re: Please help newbie with Module problem.
> >
> >
> > Hrm.
> >
> > Off the top of my head, I've not a clue.
> >
> > Did you setup Apache with a
> >
> > PerlHandler /path/to/file_with_script.perl
> >
> > directive?
> >
> > S.T.O.U.T. = Synthetic Technician Optimized for Ultimate
> > Troublshooting
> > - Original Message - 
> > From: "Matt Corbett" <[EMAIL PROTECTED]>
> > To: "'Dennis Stout'" <[EMAIL PROTECTED]>
> > Sent: Wednesday, July 02, 2003 09 49
> > Subject: RE: Please help newbie with Module problem.
> >
> >
> > >
> > >
> > > Thanks Dennis, It's now giving me "Premature end of script
> > > headers:". Can you help me again.
> > >
> > > Matt
> > > -Original Message-
> > > From: Dennis Stout [mailto:[EMAIL PROTECTED]
> > > Sent: 02 July 2003 17:46
> > > To: Matt Corbett; [EMAIL PROTECTED]
> > > Subject: Re: Please help newbie with Module problem.
> > >
> > >
> > > > this, however the line   $r->content-type('text/html'); seems to
> be
> > > > giving my compiler some problems. You could'nt just give me a hint
> > > > on
> > >
> > > My mistake, shift key didn't get pressed hard enough =P
> > >
> > > $r->content_type('text/html');
> > >
> > > Dennis
> > >
> > >
> >
>
>



RE: Please help newbie with Module problem.

2003-07-02 Thread Matt Corbett
Dennis and Randy and others on the list that gave advice,
Thank you so much for both your help. This has sorted out the problem. I
copied the *.pl files to the c:\apache\perl directory and before I made
the change to the httpd.conf file I tried it tham again and it's
perfect. If either or both of you can recommend a good charity I will
make a small donation for your time. Again thanks

Matt


-Original Message-
From: Dennis Stout [mailto:[EMAIL PROTECTED] 
Sent: 02 July 2003 19:28
To: Matt Corbett
Subject: Re: Please help newbie with Module problem.


> I don't have a PerlHandler set in my httpd.conf.
>
> How should I set this.

Edit whatever form of an httpd.conf file that Apache has under Win32
(should be hte same, location I don't know).

mv the script out of the cgi-bin and into somewhere else, like
C:/Apache/perl

Let's say the name is RequestHandler.pm

In httpd, add this line:



SetHandler perl-script
PerlHandler RequestHandler



Restart Apache, and any access to blah.yourdomain.whatever/ should get
trapped in there.

You may need to add the other standard apache directives to that, like
ServerName blah.yourdomain.whatever and so on, but probably not.

>
> I think we are so close I can almost feel it.

Yes, we are.  The code I sent you is hte core of hte project I'm
currently programming, which includes an entire dispatch table.

Now if only I could get it to grab the right friggin string from a SQL
server to authenticate >:|

>
>
> -Original Message-
> From: Dennis Stout [mailto:[EMAIL PROTECTED]
> Sent: 02 July 2003 18:57
> To: Matt Corbett
> Subject: Re: Please help newbie with Module problem.
>
>
> Hrm.
>
> Off the top of my head, I've not a clue.
>
> Did you setup Apache with a
>
> PerlHandler /path/to/file_with_script.perl
>
> directive?
>
> S.T.O.U.T. = Synthetic Technician Optimized for Ultimate
> Troublshooting
> - Original Message - 
> From: "Matt Corbett" <[EMAIL PROTECTED]>
> To: "'Dennis Stout'" <[EMAIL PROTECTED]>
> Sent: Wednesday, July 02, 2003 09 49
> Subject: RE: Please help newbie with Module problem.
>
>
> >
> >
> > Thanks Dennis, It's now giving me "Premature end of script
> > headers:". Can you help me again.
> >
> > Matt
> > -Original Message-
> > From: Dennis Stout [mailto:[EMAIL PROTECTED]
> > Sent: 02 July 2003 17:46
> > To: Matt Corbett; [EMAIL PROTECTED]
> > Subject: Re: Please help newbie with Module problem.
> >
> >
> > > this, however the line   $r->content-type('text/html'); seems to
be
> > > giving my compiler some problems. You could'nt just give me a hint
> > > on
> >
> > My mistake, shift key didn't get pressed hard enough =P
> >
> > $r->content_type('text/html');
> >
> > Dennis
> >
> >
>




RE: FW: Please help newbie with Module problem.

2003-07-02 Thread Randy Kobes
On Wed, 2 Jul 2003, Matt Corbett wrote:

> -Original Message-
> From: Randy Kobes [mailto:[EMAIL PROTECTED]
> Sent: 02 July 2003 19:39
> To: Matt Corbett
> Cc: [EMAIL PROTECTED]
> Subject: Re: FW: Please help newbie with Module problem.
>
> Does it help if you put a
>PerlModule Apache::Request
> directive in, before the directives defining your registry location?
> -

> Randy,
> Does'nt seem to make any difference.
> Matt

Strange  On the off-chance, does stopping completely
the server, then restarting it, plus also clearing the
cache from the browser, do anything?

-- 
best regards,
randy


RE: FW: Please help newbie with Module problem.

2003-07-02 Thread Matt Corbett
Randy,
Does'nt seem to make any difference.
Matt
-Original Message-
From: Randy Kobes [mailto:[EMAIL PROTECTED] 
Sent: 02 July 2003 19:39
To: Matt Corbett
Cc: [EMAIL PROTECTED]
Subject: Re: FW: Please help newbie with Module problem.


On Wed, 2 Jul 2003, Matt Corbett wrote:

> Yes, mod/perl/html scripts are fine except if I try to use 
> Apache::Request. I can even 'use' it but the problem arises when I try

> to utilise it with the 'new' method.

The fact that you can 'use' it (without doing anything with it) is
encouraging, as that means the files are probably in the expected
places, and Apache/mod_perl can use/load them.

Does it help if you put a
   PerlModule Apache::Request
directive in, before the directives defining your registry location?

-- 
best regards,
randy



Re: FW: Please help newbie with Module problem.

2003-07-02 Thread Randy Kobes
On Wed, 2 Jul 2003, Matt Corbett wrote:

> Yes, mod/perl/html scripts are fine except if I try to use
> Apache::Request. I can even 'use' it but the problem arises
> when I try to utilise it with the 'new' method.

The fact that you can 'use' it (without doing anything with it)
is encouraging, as that means the files are probably in the
expected places, and Apache/mod_perl can use/load them.

Does it help if you put a
   PerlModule Apache::Request
directive in, before the directives defining your registry
location?

-- 
best regards,
randy


FW: Please help newbie with Module problem.

2003-07-02 Thread Matt Corbett


Randy,
Good idea about the archive. I will do so.

Yes, mod/perl/html scripts are fine except if I try to use
Apache::Request. I can even 'use' it but the problem arises when I try
to utilise it with the 'new' method.

Matt

-Original Message-
From: Randy Kobes [mailto:[EMAIL PROTECTED] 
Sent: 02 July 2003 19:09
To: Matt Corbett
Subject: RE: Please help newbie with Module problem.


On Wed, 2 Jul 2003, Matt Corbett wrote:

> Randy,
> No errors, It returns 1
> Matt

Does a simple Registry script (without Apache::Request)
work from the same location?

And, for the benefit of archiving, you might want to
include the mod_perl list in the reply - that'll help
others in the future who have similar difficulties.

-- 
best regards,
randy



Re: Please help newbie with Module problem.

2003-07-02 Thread Randy Kobes
On Wed, 2 Jul 2003, Matt Corbett wrote:

> Dear List,
> I have got a problem that I can't fix no way, no how.
>
> I am porting a Linux website to xp pro.
>  I need to use the Apache::Request module on a range of
> programs to use POST and GET methods in my HTML to process
> information gathered.
>
> The port I am using is the Activestate Apache/1.3.27 (Win32)
> mod_ssl/2.8.14 OpenSSL/0.9.7b mod_perl/1.27_01-dev
>
> I have installed 'Apache::Request with perl -MCPAN -e "shell"' and
> 'install Apache::Request' . and if I try to run the install I get a
> message saying 'Apache::Request is up to date'
>  I dont seem to be able to test the module becuase I cannot
> make it with NMAKE.EXE, is this necessary. I use nmake15.exe
> should I be using a later one.

To build the module, you'll need a C compiler (Visual C++ 6, if
you want compatibility with ActivePerl). But since CPAN.pm
believes Apache::Request is up to date, you probably have a
working version, in principle. Does
   C:\> perl -MApache::Request -e "print 1"
produce any error?

> The @INC is c:\perl\lib and c:\perl\site\lib
>
> The request.pm is in /perl/site/lib/apache
>
> however when I run the following code
>
> #!c:/perl/bin/perl -w
>  use Apache ();
> use Apache::Request ();
> use CGI::Carp qw(fatalsToBrowser);
> my $r = Apache::Request->new(shift);
> # my $apr = Apache::Request->new($r);
> print  "Content-type:text/html\n\n";
> print "Hello, World...\n";
> print $r;
> print @INC;
>  I receive the message Can't locate object method "new" via
> package "Apache::Request" (perhaps you forgot to load
> "Apache::Request"?) at c:\apache\cgi-bin\ap2.pl line 6.

This script ran fine for me under Apache::Registry with
ActivePerl 635 / mod_perl 1.27 / Apache 1.3.27. From where are
you running it? And does a simple Apache::Registry script that
just prints out "Hello" work from the same location?

-- 
best regards,
randy kobes


Re: Please help newbie with Module problem.

2003-07-02 Thread Dennis Stout
> this, however the line   $r->content-type('text/html'); seems to be
> giving my compiler some problems. You could'nt just give me a hint on

My mistake, shift key didn't get pressed hard enough =P

$r->content_type('text/html');

Dennis



Re: Please help newbie with Module problem.

2003-07-02 Thread Perrin Harkins
On Wed, 2003-07-02 at 11:50, Matt Corbett wrote:
> I need to use the Apache::Request module on a range of programs to use
> POST and GET methods in my HTML to process information gathered.

Actually, you don't.  You can use CGI.pm, CGI::Simple, CGI_Lite, etc.
for this.

If you want to use Apache::Request but can't get your own compile to
work, try one of the pre-compiled binaries available here:
http://perl.apache.org/download/binaries.html

- Perrin


Re: Please help newbie with Module problem.

2003-07-02 Thread Dennis Stout
> however when I run the following code
>
> #!c:/perl/bin/perl -w
>  use Apache ();
> use Apache::Request ();
> use CGI::Carp qw(fatalsToBrowser);
> my $r = Apache::Request->new(shift);
> # my $apr = Apache::Request->new($r);
> print  "Content-type:text/html\n\n";
> print "Hello, World...\n";
> print $r;
> print @INC;
>
> I receive the message
> Can't locate object method "new" via package "Apache::Request" (perhaps
> you forgot to load "Apache::Request"?) at c:\apache\cgi-bin\ap2.pl line
> 6.

mod_perl sends $r to the handler() subroutine by default.  That is, if you're
using it in a PerlHandler context, like you should with anything that uses
Apache::Request.

Therefore, th ollowing should work for you.

#!/usr/bin/perl -w
use strict;

use Apache::Constants qw(:common);

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;

  $r->content-type('text/html');
  $r->status(200);

  my $html = "Hello World!You
Tried To Access URI: ". $r->uri ."";

 $r->send_http_header;
  print $html;
}



Please help newbie with Module problem.

2003-07-02 Thread Matt Corbett
Title: Message



Dear 
List,
I have got a problem 
that I can't fix no way, no how. 
 
I am porting a Linux 
website to xp pro.
 
I need to use the 
Apache::Request module on a range of programs to use POST and GET methods 
in my HTML to process information gathered.
 
The port I am using 
is the Activestate Apache/1.3.27 (Win32) mod_ssl/2.8.14 OpenSSL/0.9.7b 
mod_perl/1.27_01-dev 
 
I have installed 
'Apache::Request with perl -MCPAN -e "shell"' and 'install 
Apache::Request' . and if I try to run the install I get a message saying 
'Apache::Request is up to date'
 
I dont seem to be 
able to test the module becuase I cannot make it with NMAKE.EXE, is this 
necessary. I use nmake15.exe should I be using a later one.
 
The @INC is 
c:\perl\lib and c:\perl\site\lib
 
The request.pm is in 
/perl/site/lib/apache
 
however when I run 
the following code
 
#!c:/perl/bin/perl 
-w use Apache ();use Apache::Request ();use CGI::Carp 
qw(fatalsToBrowser);my $r = Apache::Request->new(shift);# my 
$apr = Apache::Request->new($r);print  
"Content-type:text/html\n\n";print "Hello, World...\n";print 
$r;print @INC;
 
I receive the 
message Can't locate object method "new" via package "Apache::Request" (perhaps you forgot to load "Apache::Request"?) at c:\apache\cgi-bin\ap2.pl line 6.

This prob has been with 
me a weeka nd I just don't seem to be able to find a 
resolution.
 
Matt