Re: modperl : how resolve conflict funtion name in different package

2003-01-16 Thread Steve Piner


"Ouimet, Pierre" wrote:

> hi!
> 
> I have that (by exemple ) :
> 
> package pack1.pm
> 
> sub get_data {
># ...
> }
> 
> package pack2.pm
> 
> sub get_data {
># same name, but doing other thing
> }
> 
> I don't use export and I have conflict with this 2 package in log file
>  (because it detect same function)
> 
> In modperl I can't have same function ? That's impossible ! I can't
> beleive that!
> 
> Is it possible to allow it ? In apache config or... !?
> 
> Tanks a lot in advance! :)
> 
> bye
> 
> Finder

It sounds like you're not actually using the package statement: pack1.pm
should have a line at the beginning of the file saying 'package pack1;'
and pack2.pm should have a line saying 'package pack2;'

I'm only guessing what the problem is here, as you don't state exactly
what the error message is.


Steve

-- 
Steve Piner
Web Applications Developer
Marketview Limited
http://www.marketview.co.nz



Re: mp2: Pb using HTML::Entities

2002-11-25 Thread Steve Piner


gilles wrote:
> 
> I write in my handler something like  :
> 
> use HTML::Entities;
> ...
>  $r->content_type('text/html;charset=iso-8859-1')
> my $txt="Long life to the ¤";
> &decode_entities($txt)
> $r->print ($txt);
> return Apache::OK;
> 
> I get in my navigator : "Long life to the ." (where . is a symbol
> different from euro symbol).

If the character you're getting is a circle with 4 'spokes' extending
from it to the top left, top right, bottom left and bottom right, then
it's working - however, that's the universal currency symbol.

For the euro, use € or €


Steve

-- 
Steve Piner
Web Applications Developer
Marketview Limited
http://www.marketview.co.nz



Re: FW: mod_perl / PerlAuthenHandler question

2002-10-28 Thread Steve Piner

It sounds like mod_perl is installed and running OK. Quoting from
<http://httpd.apache.org/docs/mod/core.html#limit>:

   In the general case, access control directives
   should not be placed within a  section.

Do you need the  section? Can you run without it?


Steve


"Mitchel, Jennifer (Jem)" wrote:

[...]
>   I am running Apache 1.3.22 and mod_perl 1.21 on a Sun Solaris 2.6 machine.  I'm 
>sure Apache and mod_perl are running as I can successfully grab that out of 
>$ENV{SERVER_SOFTWARE}.  I'm using perl 5.005_03.
> 
>   I am trying use a .htaccess file to allow NT Authenitcation on a directory.  
>However, I am getting a server error
> 
>   > Syntax error on line 6 of /web/content/askLucent/password-reset/.htaccess:
>   > Invalid command 'PerlAuthenHandler', perhaps mis-spelled or defined by a
>   > module not included in the server configuration
> 
> Here are the contents of my .htaccess file
> 
> 
> AuthName "NT Domain\Login and Password"
> AuthType Basic
> #PerlSetVar NT_Controllers 'na02il0015dc00:na02il0015dc01'
> PerlSetVar NT_Controllers 'na02il0015dc04:na02il0015dc01:NA02IL0015DC02'
> PerlAuthenHandler Apache::AuthenN2
> require valid-user
> 
> 
> I did build mod_perl with EVERYTHING=1 and did a make install and stopped & 
>restarted Apache.  Printing out the SERVER_SOFTWARE environment variable it shows 
>'Apache/1.3.22 (Unix) mod_perl/1.21'.  What else can I do to see if mod_perl works?
> 
> Jem
> 
> -Original Message-
> From: Steve Piner [mailto:stevep@;marketview.co.nz]
> Sent: Monday, October 28, 2002 3:30 PM
> To: Mitchel, Jennifer (Jem)
> Subject: Re: mod_perl / PerlAuthenHandler question
> 
> "Mitchel, Jennifer (Jem)" wrote:
> >
> > Steve,
> >
> >   I read your reply to a POST:  
>http://mathforum.org/epigone/modperl/flygrexspir/3D447423.895BFCB5@;marketview.co.nz.
> >
> >   I am seeing the same error & I did build my mod_perl with EVERYTHING=1.  Any 
>other ideas on what I'd be missing?
> >
> > Jem
> 
> No idea as yet.  What operating system are you building on?  What is the
> command line you are using?  Does mod_perl work OK other than the
> authentication and authorisation?
> 
> Also, do you mind if we also send replies to the mod_perl list? I don't
> know everything, and someone is more likely to spot any errors that I
> might make.
> 
> Steve
> 
> --
> Steve Piner
> Web Applications Developer
> Marketview Limited
> http://www.marketview.co.nz

-- 
Steve Piner
Web Applications Developer
Marketview Limited
http://www.marketview.co.nz



Re: newbie: file uploads not working :(

2002-09-12 Thread Steve Piner



Geoffrey Young wrote:
> 
> > Note: If you ever use them in file posts, don't forget to clean the file
> > names, especially when it comes from Windows machine...
> >
> 
> I've found this to be reasonably portable for getting just the
> filename (sans path) - YMMV
> 
> my ($name) = $upload->filename =~ m!([^/\\]*$)!;

Erm.. portable maybe, (MacOS?) but what about secure? That lets through
shell meta-characters, which may or may not be a problem. (What if the
filename is '|mail%20cracker@somewhere'?)

I'm inclined to be a little more restrictive:

my ($name) = $upload->filename =~ m!([^\w\.]*$)!;

(And even then, that's not secure under windows - NUL, LPT1, etc.)

Steve

-- 
Steve Piner
Web Applications Developer
Marketview Limited
http://www.marketview.co.nz



Re: Using Constants from seperate file

2002-07-28 Thread Steve Piner


What does 'Constants.lib' look like? Does it have a 'package' statement?
Does it use Exporter?

If it's a package then unless you've got some magic in 'Constants.lib',
that BEGIN block will not pull the constants into the current package -
the 'import' call is missing. (See perldoc -f use)

If it isn't a package, then it will only get pulled into the first
package that 'require's it. In this case you probably want to be using
'do "file"' rather than 'require', however it would probably be better
to convert the file into a proper package.

What's so terrible about loading the constants file at startup?


Steve Piner


allan juul wrote:
> 
> hi
> 
> i wish to use use constants defined in a seperate file. my problem is, that
> sometimes it works sometimes it doesn't. when failing, the error_log says
> Bareword is not allowed so i guess it sometimes never loads my constants file
> at all.
> 
> this is my basic approach:
> 
> Package Foo:Bar;
> 
> use strict;
> 
> BEGIN {
>   require "Constants.lib";
> }
> 
> sub handler {
>   my $r = shift;
>   ...
> 
>   my $sql = SQL_SELECT; # pull in constant value
>   
> 
> }
> 
> is this a stupid approach, and if so what would be a more correct solution?
> (i would prefer _not_ to have the constant file loaded once and for all in a
> startup.pl).
> 
> any suggestions appriciated
> thanks
> ./allan

-- 
Steve Piner
Web Applications Developer
Marketview Limited
http://www.marketview.co.nz



Re: mod_perl PerlAccessHandler/PerlAuthenHandler question

2002-07-28 Thread Steve Piner


How is your mod_perl configured? Based on the error message you're
getting, it appears that you may not have compiled in support for
authentication or access control.

If you built it yourself, you may need to add PERL_AUTHEN=1 and
PERL_ACCESS=1 to the 'perl Makefile.PL' command line when building
mod_perl. Unless you have reason not to, I'd recommend that you compile
it with EVERYTHING=1.

Steve Piner


Harry Zhu wrote:
> 
> I'm a verteran CGIer but a new mod-perl user.
> I have got the mod-perl running fine for the content handling. But when I
> try to step in to other stages like Authentication, and have trouble in
> setting
> PerlAccessHandler
> PerlAuthenHandler
> etc.
> 
> If I put
> ###==
> 
>   SetHandler perl-script
>   PerlHandler Apache::Hello
> 
> 
> ###==
> in the perl.conf file, it's ok. I got the expected from the browser. But
> when I changed above to
> 
> ###==
> PerlModule Apache::AuthAnon
> 
>   AuthName Anonymous
>   AuthType Basic
>   PerlAuthenHandler Apache::AuthAnon
>   require valid-user
> 
>   PerlSetVar Anonymous anonymous|anybody
> 
>   SetHandler perl-script
>   PerlHandler Apache::Hello
> 
> 
> ###==
> 
> and try to restart the server, I got
> Syntax error on line 9 of /usr/local/apache/conf/perl.conf:
> Invalid command 'PerlAuthenHandler', perhaps mis-spelled or defined by a
> module not included in the server configuration
> 
> When I set up .htaccess in a directory "test" under DocumentRoot,
> ###==
> PerlAccessHandler Apache::GateKeeper
> PerlSetVar Gate closed
> 
> ###==
> and try to access this directory, the server gives the "Internal Error":
> /usr/local/apache/htdocs/test/.htaccess: Invalid command
> 'PerlAccessHandler', perhaps mis-spelled or defined by a module not included
> in the server configuration
> 
> I can add "use Apache::GateKeeper ();" in the startup.pl and start the
> server without problem, so the module itself should be in the proper path
> for tyhe server to load.
> 
> Any help on this will be apprieciated.
> 
> Harry
> GreatLodge.com

-- 
Steve Piner
Web Applications Developer
Marketview Limited
http://www.marketview.co.nz



Re: New mod_perl site and oddness with IE

2002-07-17 Thread Steve Piner



Allan Juul wrote:
> 
> before the mails comes tumbling in ...
> 
> please check this url [tested on winXP/IE6.0] as already send to the docs
> list and original poster
> 
> http://www.bullitt.suite.dk/clean3/dst_html/docs/1.0/guide/performance.html
> 
> thanks
> ./allan
> 
> 
> 
> > (There was no reason *why* taking out the 'position: relative's should
> > work - it just struck me as the first thing that wasn't
> > necessary in the
> > style sheet. Possibly irritating an IE bug just a little too much)
> 
> not sure which rule of position you were talking about. the above url
> specify no position for the rightbox div

div.rightbox had a 'position: relative' specified in ../../../style.css.
It also specified a top and left of 0, so essentially the rule was
saying 'lay out this box according to normal flow, then offset it from
its original position by 0px' i.e. don't move it.

It seemed superfluous, so I removed it. Doing so appeared to fix the
problem with no discernible side effects. As for why it isn't affecting
other pages, I have no idea. It's probably, as Stas suggests, a size
thing.

Is that the biggest page on the site?

Steve

-- 
Steve Piner
Web Applications Developer
Marketview Limited
http://www.marketview.co.nz



Re: New mod_perl site and oddness with IE

2002-07-17 Thread Steve Piner



allan juul wrote:
> 
> Quoting Jim Helm <[EMAIL PROTECTED]>:
> 
> > Has anyone else had problems with this particular page under IE
> > (6.0.2600 under XP) being extremly slow to update when paging up/down?
> > It works fine under Mozilla, and it's not a memory or cpu issue (checked
> > with task manager already). And when I say slow, I mean a simple down
> > cursor causes the visible portion of the page to get painted in 4
> > noticble steps/chunks.
> > --Jim
> 
> please check if the problem exists on this url:
> 
> http://www.bullitt.suite.dk/clean3/dst_html/docs/1.0/guide/performance.html
> 
> if you have other browser software, please check and see if anything else is
> broken there as well.
> 
> thanks a lot!
> 
> /allan

Looks good to me with  on Win98SE
  * IE 5.50.4807.2300 (SP2)
  * Netscape 4.79
  * Mozilla 2002053012
  * Opera 6.04

-- 
Steve Piner
Web Applications Developer
Marketview Limited
http://www.marketview.co.nz



Re: New mod_perl site and oddness with IE

2002-07-17 Thread Steve Piner



Stas Bekman wrote:
> 
> Jim Helm wrote:
> > Has anyone else had problems with this particular page under IE
> > (6.0.2600 under XP) being extremly slow to update when paging up/down?
> > It works fine under Mozilla, and it's not a memory or cpu issue (checked
> > with task manager already). And when I say slow, I mean a simple down
> > cursor causes the visible portion of the page to get painted in 4
> > noticble steps/chunks.
> >
> > An older version I tracked down with Google
> > (http://www.apache.jp/perl/guide/performance.html) which is also 300K+
> > doesn't have the same problem - just to show that it's not purely the
> > raw size of the page that is the problem.
> >
> > Just a little feedback for the new site (which is great, btw).  If it's
> > just me with the problem, I'll go find a rock to hide under. :)
> 
> Is the size of the page causes the trouble? I don't have IE to try so
> hopefully someone will help us out here. What happens if you shorten the
> content of the page?
> 
> My guess is that IE simply cannot cope with a long page and the current
> complex stylesheet (because as say it works fine with the same page and
> a simpler stylesheet, which includes no layout instructions).
> Suggestions on how to fix that are welcome.

IE 5.50.4807.2300 (SP2) on Win98SE

I had different problems - the first time I went to the page, IE crashed
my machine, so I had to reboot.

After I'd rebooted I went back to the page. I got the extremely slow
scrolling, but, more significantly, I got the second half of the page
overlaid on top of the first half.

I grabbed a copy of the page with Opera's 'save with images' option
(strangely enough doing it with IE, and viewing the result didn't get
the same display) and verified that the bug occurred with my local copy.

I then had a bit of a fiddle with the stylesheet, and discovered that
taking out the 'position: relative's seemed to stop the overlay,
improving IEs performance markedly without affecting the page layout in
any of the browsers I have installed (Netscape 4.79, Mozilla 2002053012,
Opera 6.04)

(There was no reason *why* taking out the 'position: relative's should
work - it just struck me as the first thing that wasn't necessary in the
style sheet. Possibly irritating an IE bug just a little too much)

Hope this helps,

Steve

-- 
Steve Piner
Web Applications Developer
Marketview Limited
http://www.marketview.co.nz



Re: [Fwd: Re: Cheap and unique]

2002-04-30 Thread Steve Piner



David Jacobs wrote:
> 
> >
> >I'm just curious - what's wrong with the function you're already using?
> >
> >Steve
> >
> 
> Mod_Perl hangs on to it's PID, so it's no longer unique. (I _believe_)

But the timestamp will make it unique - as long as you're not serving
several requests per second.

If you are, you could use a counter as well as, or in place of, the
timestamp.

All I'm saying is that CGI by itself doesn't guarantee a unique PID -
your CGI's original author probably knew that, and incorporated the
timestamp to guarantee uniqueness.


> mod_unique_id looks like a good solution, pending performance.

Yeah, agreed.

> Thanks for your help so far, everyone!
> 
> David

-- 
Steve Piner
Web Applications Developer
Marketview Limited
http://www.marketview.co.nz



Re: Cheap and unique

2002-04-30 Thread Steve Piner



David Jacobs wrote:
> 
> I'm converting a few CGI scripts that used the PID as a cyclical unique
> number (in concert with TIMESTAMP - so it was TIMESTAMP.PID).
> 
> Our goal is to find a replacement function that is extremely cheap
> (cheaper than say, random(100)) and will never repeat. Any ideas?
> Has anyone else faced this problem?
> 
> tia
> David

I'm just curious - what's wrong with the function you're already using?

Steve

-- 
Steve Piner
Web Applications Developer
Marketview Limited
http://www.marketview.co.nz



Re: Throttling, once again

2002-04-21 Thread Steve Piner


You're assuming that the spider respects cookies. I would not expect
this to be the case.


Peter Bi wrote:
> 
> How about adding a MD5 watermark for the cookie ? Well, it is becoming
> complicated 
> 
> Peter Bi
> 
> - Original Message -
> From: "kyle dawkins" <[EMAIL PROTECTED]>
> To: "Peter Bi" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Friday, April 19, 2002 8:29 AM
> Subject: Re: Throttling, once again
> 
> > Peter
> >
> > Storing the last access time, etc in a cookie won't work for a perl script
> > that's abusing your site, or pretty much any spider, or even for anyone
> > browsing without cookies, for that matter.

-- 
Steve Piner
Web Applications Developer
Marketview Limited
http://www.marketview.co.nz



Re: [ANNOUNCE] The New "mod_perl" logo - results now in...

2002-03-17 Thread Steve Piner



Mark Fowler wrote:
> 
> On Fri, 15 Mar 2002, Jonathan M. Hollin wrote:
> 
> > However, I request your comments on this idea:  should we have just one
> > button (helping to develop a distinct identity for mod_perl) or should
> > we have several (for choice)?  It's up to you...
> 
> I think that we need one "theme" of buttons, to ensure consistent
> branding.  As per my comments when I voted stated, I'd love to see some
> buttons/logos based on the winning logo.  In particular:
> 
>  - A square button that's just made up of the square cog logo
>  - A square button that's just made up of a grey m and a blue p
>  - A small rectangle version of the words modperl without the cog
> 
> ...you get the idea, variations around a central design
> 
> Also, we could do with both a monochrome and a black and white version of
> the logo (for print.)
> 
> Is the logo available in a vector file format so that we can easily make
> scaled copies of it?  Or are we restricted to the pixel banners that
> currently exist?
> 
> Later.
> 
> Mark.
> 
> --
> s''  Mark Fowler London.pm   Bath.pm
>  http://www.twoshortplanks.com/  [EMAIL PROTECTED]
> ';use Term'Cap;$t=Tgetent Term'Cap{};print$t->Tputs(cl);for$w(split/  +/
> ){for(0..30){$|=print$t->Tgoto(cm,$_,$y)." $w";select$k,$k,$k,.03}$y+=2}


I definitely agree with this. I'd like to see some more colour
variations (maybe just background colours even) to allow it to fit into
a site's design better.

Jonathan asked whether we should have just one button, or several. I'd
say just one theme, with several variations as mentioned above.

Others have suggested several buttons and I'm assuming they mean with
differing themes. I'm against that, as the point of a logo is to
reinforce the branding of mod_perl. Of course, if people don't want to
use this theme, they won't. That's fine. That's no worse than the
current situation.

Finally, I think the mod_perl/modperl/ModPerl/Mod_perl thing is a
non-issue. We all know what is being talked about, right? It's nowhere
near as bad as the .gif "hard 'G' or soft 'G'" or the vi "V.I. versus
'vie'" problems.

Steve

-- 
Steve Piner
Web Applications Developer
Marketview Limited
http://www.marketview.co.nz



Re: Question...

2002-02-13 Thread Steve Piner


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

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

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

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

Steve Piner


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



Re: Single login/sign-on for different web apps?

2002-01-16 Thread Steve Piner


Vsevolod Ilyushchenko wrote:

> Yes, but I still should be able to propely handle people who go to any of
> the protected sites first thing in the morning. I don't think I can get
> away with only exit-point authentication that you propose. If the
> entrance-point authentication works well, there should be no need for this
> additional level. (Please correct me if I am wrong. :)

Do cookies get set if returned via an image?

If so, once the user has logged in, you could return a page with
invisible images on it, where each image is from each site that the user
needs to be authenticated to.

Each image is unimportant. The important bit is that an authentication
cookie is set for each domain the image is returned from.

This leaves one tricky point as far as I can see: you need to securely
identify which image request comes from each user. The obvious/easy way
would be to put some sort of unique identifier in the path or query
string, but this may not be secure enough for your purposes.

Oh yeah, it'd break if they didn't have images on. :-(

Steve

-- 
Steve Piner
Web Applications Developer
Marketview Limited
http://www.marketview.co.nz



Re: Install problems

2001-11-04 Thread Steve Piner



John Michael wrote:

> Checking if your kit is complete.
> Looks good
> Writing Makefile for libapreq
> mkdir blib/lib
> mkdir blib/lib/auto
> mkdir blib/lib/auto/libapreq
> mkdir blib/man3
> cp libapreq.pod blib/lib/libapreq.pod
> cp lib/Apache/libapreq.pm blib/lib/Apache/libapreq.pm
> make[1]: Entering directory `/usr/local/etc/libapreq-0.33/c'
> gcc -c -I/usr/lib/perl5/site_perl/5.6.0/i386-linux/auto/Apache/include
> -I/us
> r/lib/
> perl5/site_perl/5.6.0/i386-linux/auto/Apache/include/modules/perl
> -fno-stric
> t-
> aliasing -02 -march=i386 -mcpu=i386 -DVERSION=\"0.10\"
> -DXS_VERSION=\"0.10\
> "
>  -fPIC -I/usr/lib/perl5/5.6.0/i386-linux/CORE  apache_request.c
> In file included from apache_request.c:58:
> apache_request.h:5:19: httpd.h: No such file or directory
> apache_request.h:6:25: http_config.h: No such file or directory
> apache_request.h:7:23: http_core.h: No such file or directory
> apache_request.h:8:22: http_log.h: No such file or directory
> apache_request.h:9:23: http_main.h: No such file or directory
> apache_request.h:10:27: http_portocol.h: No such file or directory
> apache_request.h:11:25: util_script.h: No such file or directory
> make[1]: *** [apache_request.o] Error 1
> make[1]: Leaving directory `/usr/local/etc/libapreq-0.33/c'
> make[1]: *** [subdirs] Error 2
> 
> I'm confused.

It looks like you might not have the 'apache-devel' package installed.
(You did say you were on RedHat, didn't you?) Try installing that.

Steve

-- 
Steve Piner
Web Applications Developer
Marketview Limited
http://www.marketview.co.nz



Re: Installing modules

2001-11-04 Thread Steve Piner



John Michael wrote:

> Where can I find information on how to install modules like:
> Apache::Request libapreq-0.33.tar.gz
> Apache::DBIApacheDBI-0.88.tar.gz
> 
> Would I install these as regular perl modules or are they installed as
> apache modules?

They are regular perl modules. They only run under mod_perl though. :-)

If you can, use the CPAN shell to install modules, (see 'perldoc CPAN')

Otherwise, download and extract the module then change into its
directory. Read the README and INSTALL files. Then - assuming those
files don't say differently - type

perl Makefile.PL
make
make test

And if you're happy with the results, su to root and type

make install

Hope this helps.

Steve

-- 
Steve Piner
Web Applications Developer
Marketview Limited
http://www.marketview.co.nz



Re: Apache 1.3.22 and modperl 1.26.

2001-10-30 Thread Steve Piner



Brad Dameron wrote:

> I installed mod perl and php 4 into along with apache 1.3.22. When I add the
> following:
> 
> 
> 
> AddHandler perl-script .cgi
> PerlHandler HTML::Mason
> 
> 
>  require "/var/conf/apache/handler.pl";
> 
> 
> 
> and then try to start apache I get this error:
> 
> Syntax error on line 338 of /var/conf/apache/httpd.conf:
> Invalid command '', perhaps mis-spelled or defined by a module not
> include
> d in the server configuration
[trimmed]

It sounds to me that when you recompiled mod_perl, you forgot to add
PERL_SECTIONS=1 on the command line.

Steve

-- 
Steve Piner
Web Applications Developer
Marketview Limited
http://www.marketview.co.nz



PerlInitHandler w/o PerlPostReadRequestHandler.

2001-10-28 Thread Steve Piner


I came across an unexpected feature of PerlInitHandler today.

In the distant past, for whatever reason, I configured mod_perl to have
PerlInitHandler, but not PerlPostReadRequestHandler.

Today I tried to hook a handler to PerlPostReadRequestHandler, and got
an error on start up, saying that I hadn't compiled it in.

Rather than recompile Apache, I dug out the Eagle book to find another
suitable handler. I discovered PerlInitHandler.

The Eagle says that PerlInitHandler is an alias for
PerlPostReadRequestHandler when used at the 'top-level' of a
configuration file.

Great, I thought. I'll try it.

Apache started quite happily.

But my handler wasn't being called.

Hmm, I thought. So I had a closer read of the PerlInitHandler section,
and noted it said *alias*.

To cut the story short, I recompiled apache, adding the
'PERL_POST_READ_REQUEST=1' necessary. It worked perfectly first time.


My question is this: should PerlInitHandler have given me an error
message?


Steve

-- 
Steve Piner
Web Applications Developer
Marketview Limited
http://www.marketview.co.nz



Re: When to use 'use' for accessing modules?

2001-10-23 Thread Steve Piner



Perrin Harkins wrote:

> Chris Allen wrote:
[...]
> > Is $ENV{foo}='bar'; in startup.pl equivalent to PerlSetEnv foo bar
> > in httpd.conf?
> 
> Yes.

Are you sure? I experimented a few months ago, and found that
$ENV{foo}='bar'; would only last in each child until the first request
of the child completed.

Steve

-- 
Steve Piner
Web Applications Developer
Marketview Limited
http://www.marketview.co.nz



Re: Problem with arrayrefs in PSections

2001-07-29 Thread Steve Piner



Geoffrey Young wrote:
> 
> without having an environment to test on or the Eagle book to reference...
> 
> I seem to recall something in the Eagle book about arguments to Allow and
> Deny - that "from 10.3.4.1" is really a single argument and not two (in the
> TAKE2 sense), so maybe your approach is wrong and you need to make each of
> those entries in your array a single string.

Thanks, but that's not it.

Allow => ['from 1.2.3.0/24', 'from 192.168.1.0/24'],

is treated as the directive 'Allow from 1.2.3.0/24 from 192.168.1.0/24'
which of course doesn't work.

Allow => [['from 1.2.3.0/24'], ['from 192.168.1.0/24']],

gives me the following error:

[Mon Jul 30 09:55:21 2001] [error] : allow requires at least two
arguments, 'from' followed by hostnames or IP-address wildcards

The Eagle says that directives that occur multiple times should be an
array of arrays. And it works when I'm not using a single arrayref for
the configuration.

Steve

> -Original Message-
> From: Steve Piner
> To: [EMAIL PROTECTED]
> Sent: 7/27/01 12:26 AM
> Subject: Problem with arrayrefs in PSections
> 
> I've come across an oddity in configuring Apache through Perl sections.
> 
> If I have a local as follows,
> 
> my %access = (
> Order => 'deny,allow',
> Deny => 'from all',
> Allow => [['from', '1.2.3.0/24'],
>   ['from', '192.168.1.0/24']],
> );
> 
> then set up locations (or directorys) as follows
> 
> %Location = (
> '/server-status' => {
> SetHandler => 'server-status',
> %access,
> },
> '/server-info' => {
> SetHandler => 'server-info',
> %access,
> },
> );
> 
> Then only one of the locations will let me access it.
> 
> http://servername/server-status will let me in,
> http://servername/server-info won't.
> 
> The problem seems to be with the shared reference: changing the 'Allow'
> line above to
> Allow => 'from all' works - though without the desired restriction of
> course, as does
> changing the code above to the following.
> 
> %Location = (
> '/server-status' => {
> SetHandler => 'server-status',
> %access,
> Allow => [['from', '1.2.3.0/24'],
>   ['from', '192.168.1.0/24']],
> },
> '/server-info' => {
> SetHandler => 'server-info',
> %access,
> Allow => [['from', '1.2.3.0/24'],
>   ['from', '192.168.1.0/24']],
> },
> );
> 
> Is this a bug, a stupid-user problem, or something else?
> 
> I'm using Apache/1.3.20, mod_perl/1.25 and 1.26, and Perl v5.6.1
> 
> Steve
> 
> --
> Steve Piner
> Web Applications Developer
> Marketview Limited
> http://www.marketview.co.nz

-- 
Steve Piner
Web Applications Developer
Marketview Limited
http://www.marketview.co.nz



Problem with arrayrefs in PSections

2001-07-26 Thread Steve Piner


I've come across an oddity in configuring Apache through Perl sections.

If I have a local as follows,

my %access = (
Order => 'deny,allow',
Deny => 'from all',
Allow => [['from', '1.2.3.0/24'],
  ['from', '192.168.1.0/24']],
);

then set up locations (or directorys) as follows

%Location = (
'/server-status' => {
SetHandler => 'server-status',
%access,
},
'/server-info' => {
SetHandler => 'server-info',
%access,
},
);

Then only one of the locations will let me access it. 

http://servername/server-status will let me in,
http://servername/server-info won't.

The problem seems to be with the shared reference: changing the 'Allow'
line above to
Allow => 'from all' works - though without the desired restriction of
course, as does 
changing the code above to the following.

%Location = (
'/server-status' => {
SetHandler => 'server-status',
%access,
Allow => [['from', '1.2.3.0/24'],
  ['from', '192.168.1.0/24']],
},
'/server-info' => {
SetHandler => 'server-info',
%access,
Allow => [['from', '1.2.3.0/24'],
  ['from', '192.168.1.0/24']],
},
);

Is this a bug, a stupid-user problem, or something else?

I'm using Apache/1.3.20, mod_perl/1.25 and 1.26, and Perl v5.6.1


Steve

-- 
Steve Piner
Web Applications Developer
Marketview Limited
http://www.marketview.co.nz



Re: Content-Disposition to change type and action?

2001-05-29 Thread Steve Piner



Jay Jacobs wrote:

> I've got a form that will (should) send various formats back to the client
> depending on form values.  They may want the results back in csv, pdf or
> plain html.  The form always submits to a .html, and the browser usually
> expects an html.

My suggestion is to use mod_rewrite to create a mapping so that the
actual file name doesn't matter. I have a rule in the Apache conf file:

RewriteRule ^/reports/ /bin/report.pl [PT]

So going to <http://www.mysite.com/reports/foo.csv?param1=val1> would be
the same as going to <http://www.mysite.com/bin/report.pl?param1=val1>
except if the page is to be downloaded, the browser will use the name
foo.csv.

There's another parameter which gets passed to /reports/whatever.csv to
indicate that it should generate a csv, and send a suitable
Content-Type, but getting the 'name' right solves half the problem.

Steve

-- 
Steve Piner
Web Applications Developer
Marketview Limited
http://www.marketview.co.nz