Re: CGI.pm problem

2001-10-30 Thread Cees Hek

On Wed, 31 Oct 2001 02:31, you wrote:
> Hello,
>
> When I try to make a CGI object in my Apache/mod_perl handler a la $q =
> CGI->new(); The server just don't reply. Actually it works just fine
> until I try to submit a form, then it just hangs and Apache doesn't send
> anything back. If I remove this object creation line, then I can submit
> my form (but then its no use, i can't use the data). What could be the
> problem?

What version of CGI.pm are you using?  I seem to remember a problem with
mod_perl and an older version of CGI.pm where CGI.pm was fooled into thinking
it was run in command line mode.

If you are seeing the following line in your logs then this is definately the
cause of your problem:

 (offline mode: enter name=value pairs on standard input)

To fix this put $CGI::NO_DEBUG=1 near the top of your program or upgrade
CGI.pm.

Cees

ps you should be using Apache::(Request|Cookie) to get your GET/POST/COOKIE
parameters, as it is more efficient.

---



Re: PerlModule not updating %INC

2001-10-30 Thread David Pisoni

I'm still having this problem, and I've discovered that it is also happening on my 
darwin box.  This is enough to lead me to believe the problem is bona fide.

To recap: problem occurs on :
Darwin (MacOS X) Perl 5.6.0 / Apache 1.3.20 / mod_perl 1.26
Red-Hat Linux (7.1) Perl 5.6.0 / Apache 1.3.20 / mod_perl 1.26
Red-Hat Linux (7.1) Perl 5.6.1 / Apache 1.3.20 / mod_perl 1.26

Problem : PerlModule does not cause %INC to be updated, but 'use' does

Symptoms : Apache::StatINC does not work for said modules.  Said modules do not appear 
in Apache::Status "loaded modules" page, but do appear in the Inheritance tree.

Ideas?

Thanks,
David

>Date: Thu, 18 Oct 2001 12:57:27 -0800
>To: Stas Bekman <[EMAIL PROTECTED]>
>From: David Pisoni <[EMAIL PROTECTED]>
>Subject: Re: PerlModule not updating %INC
>Cc: Perrin Harkins <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
>Bcc:
>X-Attachments:
>
>At 1.13 +0800 10/17/2001, Stas Bekman wrote:
>>David Pisoni wrote:
>>
At 18.23 -0400 10/11/2001, Perrin Harkins wrote:

>>At 18.07 -0400 10/11/2001, Perrin Harkins wrote:
>>
We are using perl 5.6.0 for Apache 1.3/20, with mod_perl 1.26.

>>>Are you sure?  There was a problem with %INC and PerlModule, but I
>>>
>thought
>
>>>it was fixed in 1.26.
>>>
>>>- Perrin
>>>
>>Indeed, like I said, I tested it by dumping %INC myself -- the modules are
>>
>indeed missing when loaded with PerlModule.
>
>No, I meant are you sure you're running 1.26?  Please doublecheck it, since
>this sounds so much like the bug from the previous release.
>- Perrin
>
Indeed, here's the signature from Apache::Status :

Embedded Perl version v5.6.0 for Apache/1.3.20 (Unix) (Red-Hat/Linux) 
>mod_perl/1.26

Apache.pm shows v1.27 (that's a little weird, but I assume unimportant.)

Thanks,
David

>>>
>>>So... any ideas on this one?
>>
>>
>>have you tried 5.6.1? 5.6.0 is very buggy.
>>
>
>Just tried it.  Fresh build of 5.6.1, and mod_perl 1.26 against it.  The problem 
>persists -- %INC is incomplete vs. my actual loaded modules, missing what was loaded 
>with PerlModule directives.
>
>What should I try next. :-)
>
>David




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



Re: Exporting C++ class to Perl?

2001-10-30 Thread Toni Andjelkovic

Vlad Safronov wrote on Tue, Oct 30 2001 (19:26:40 +0300):
> How can I export C++ class and its interface to Perl?

http://www.johnkeiser.com/perl-xs-c++.html

cu,
-- 
Toni Andjelkovic
<[EMAIL PROTECTED]>




Re: Persistant Data shared with other applications

2001-10-30 Thread ryc

Yes that situation can occur when the two files are part of the same
package... despite having different file names mod_perl treats them as the
same since they have the same package name. This will give you the strange
behavior that you just described. Could this be your problem?

ryan

- Original Message -
From: "Kenny Smith" <[EMAIL PROTECTED]>
To: "Modperl" <[EMAIL PROTECTED]>
Sent: Tuesday, October 30, 2001 3:20 PM
Subject: Persistant Data shared with other applications


> Hi there,
>
> I'm seeing a strange bit of behavior and wanted to find out if anyone else
> is having this problem.
>
> I have two scripts, index.mod_perl and grapevine.mod_perl.
>
> They both use HTML::Template to generate their output. The template is not
> persistant between requests, but $main::tokens is persistant.
$main::tokens
> is hashref that contains a page title variable which is passed to the
> template. The index.mod_perl's tokens contains the page title "Employee
> Portal"  and the grapevine.mod_perl contains the page title "Grapvine
> Employee Utility." They both use the same html header file during output,
> which is customized by the page_title token.
>
> My problem is that sometimes, when I go to grapevine.mod_perl, it shows me
> the "Employee Portal" title. It seems that $main::tokens from
index.mod_perl
> is being shared as $main::tokens to grapevine.mod_perl.
>
> Has anyone had this kind of thing happen?
>
> Kenny Smith
>




Persistant Data shared with other applications

2001-10-30 Thread Kenny Smith

Hi there,

I'm seeing a strange bit of behavior and wanted to find out if anyone else
is having this problem.

I have two scripts, index.mod_perl and grapevine.mod_perl.

They both use HTML::Template to generate their output. The template is not
persistant between requests, but $main::tokens is persistant. $main::tokens
is hashref that contains a page title variable which is passed to the
template. The index.mod_perl's tokens contains the page title "Employee
Portal"  and the grapevine.mod_perl contains the page title "Grapvine
Employee Utility." They both use the same html header file during output,
which is customized by the page_title token.

My problem is that sometimes, when I go to grapevine.mod_perl, it shows me
the "Employee Portal" title. It seems that $main::tokens from index.mod_perl
is being shared as $main::tokens to grapevine.mod_perl.

Has anyone had this kind of thing happen?

Kenny Smith




Re: Exporting C++ class to Perl?

2001-10-30 Thread Steven Lembark



-- Vlad Safronov <[EMAIL PROTECTED]>

> Hi,
>
> How can I export C++ class and its interface to Perl?
> Is it just like exporting simple C function to Perl (in perlxs doc.
> example)?
> Is there good (not big) CPAN examples for this problem?

perl -MCPAN -e shell;
get Inline


--
Steven Lembark   2930 W. Palmer
Workhorse Computing   Chicago, IL 60647
+1 800 762 1582



Exporting C++ class to Perl?

2001-10-30 Thread Vlad Safronov

Hi,

How can I export C++ class and its interface to Perl?
Is it just like exporting simple C function to Perl (in perlxs doc.
example)?
Is there good (not big) CPAN examples for this problem?

Vlad.





Re: Should i lock DB_File for read-only access?

2001-10-30 Thread Perrin Harkins

>  If i run this code from command line or under mod_cgi, it work fine.
> But if it run repeatedly under mod_perl, it occasionally give me a
> "database access timeout" message (see code above), but error value $!
> still empty.

What return value are you getting from tie?

Incidentally, since this is a read-only situation, you can open the dbm once
and keep the handle in a global.  Then you save time by not needing to open
it on each request.

- Perrin




Re: CGI.pm problem

2001-10-30 Thread Ken Y. Clark

On Tue, 30 Oct 2001, Viljo Marrandi wrote:

> Date: Tue, 30 Oct 2001 17:31:15 +0200
> From: Viljo Marrandi <[EMAIL PROTECTED]>
> To: modperl list <[EMAIL PROTECTED]>
> Subject: CGI.pm problem
>
> Hello,
>
> When I try to make a CGI object in my Apache/mod_perl handler a la $q =
> CGI->new(); The server just don't reply. Actually it works just fine
> until I try to submit a form, then it just hangs and Apache doesn't send
> anything back. If I remove this object creation line, then I can submit
> my form (but then its no use, i can't use the data). What could be the
> problem?
>
> Rgds,
> Viljo

Viljo,

If you're using mod_perl, is there a reason that you don't use the
Apache::Request object for reading form submissions?  Instead of
writing "$q = CGI->new()", do this:

sub handler {
my $r   = shift;
my $apr = Apache::Request->new( $r->is_main ? $r : $r->main );
my $foo = $apr->param( 'foo' ) || '';

...

return OK;
}

For more information, consult the guide.  Perhaps this section would
be useful to you:

http://perl.apache.org/guide/porting.html

ky




Apache::Compress - any caveats?

2001-10-30 Thread Igor Sysoev


I had developed Apache module mod_deflate that allow to gzip or deflate 
content:

ftp://ftp.lexa.ru/pub/apache-rus/contrib/mod_deflate-1.0.7.tar.gz

This module tested at one of the loaded Russian sites - www.rambler.ru 
and several other small Russian sites.
Documentation in Russion only but basic configuration is very simple: 

DeflateEnable on

mod_deflate encodes 'text/*' content type.
By default mod_deflate allows encoding if request is HTTP/1.1 and
request is not proxied (it can be changed). So Netscape 4 requests
is not encoded by default.

During testing I found some browser bugs with gzip:

MSIE 4.x can't handle gzipped content if length of URL string without 
'http://' prefix is bigger then 253 characters.

Mozilla 0.9.1 and Netscape 6.1b1 don't understand encoding if
header line has tralling spaces - "Content-Encoding: gzip ".

Macromedia FlashPlayer 4.x-5.x doesn't understand gzipped content
recieved by browser via getVariables() function.
 
Igor Sysoev




CGI.pm problem

2001-10-30 Thread Viljo Marrandi

Hello,

When I try to make a CGI object in my Apache/mod_perl handler a la $q =
CGI->new(); The server just don't reply. Actually it works just fine
until I try to submit a form, then it just hangs and Apache doesn't send
anything back. If I remove this object creation line, then I can submit
my form (but then its no use, i can't use the data). What could be the
problem?

Rgds,
Viljo



Re: Should i lock DB_File for read-only access?

2001-10-30 Thread Stas Bekman

Dmitry E. Dmitriev wrote:

> Hi ALL!
> 
>  Should i still lock my dbm files accessed from cgi under mod_perl if i
> need only read from them? Not my program nor any others never will write
> to
> this files.


Nope, you don't have to. In any case the used lock (flock) is usually 
advisory, which means that any other program can still access the dbm 
file in the write mode bypassing the lock (it may not know about the 
lock's existence.


>  I have a problem with code:
> 
>  use DB_File;
>  use strict;
>  my %fields;
>  my $fieldsdb='/path/to/db_file';
> 
>    some code there 
> 
> if (!(tie(%fields, 'DB_File', $fieldsdb, O_RDONLY, 0666, $DB_HASH)))
>   {print "Sorry, database access timeout. $!";}
> 
> else { 
> ...other code...
> 
>  if (defined($fields{$key})) {print "Field for $key is
> $fields{$key}\n";}
>  else {print "Field for $key not defined!\n";}
> 
> untie %fields;
> }
> 
>  If i run this code from command line or under mod_cgi, it work fine.
> But if it run repeatedly under mod_perl, it occasionally give me a
> "database access timeout" message (see code above), but error value $!
> still empty. I'm confused:  why error occurred on tie phase, before any
> read statements?


you don't show all your code, so we cannot tell. Since it doesn't work 
under mod_perl, it's probably a problem with your code, which is not 
running well in the persistent env. Can you give us a 3-4 lines script 
that we can reproduce the problem with? (3 lines should be enough to 
test whether a dbm can read/write.

 
> The second problem is - even after successful tie()-ing of database
> rarely i get "Field not defined!" message for defined keys...


the same thing, please read first:
http://perl.apache.org/guide/porting.html#Sometimes_it_Works_Sometimes_it
and other sections in the same chapter.

Also see:
http://perl.apache.org/guide/dbm.html

p.s. make sure that you enable warnings mode:
http://perl.apache.org/guide/porting.html#Command_Line_Switches_w_T_e

_
Stas Bekman JAm_pH  --   Just Another mod_perl Hacker
http://stason.org/  mod_perl Guide   http://perl.apache.org/guide
mailto:[EMAIL PROTECTED]  http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/




Re: [OT] P3P policies and IE 6 (something to be aware of)

2001-10-30 Thread Robin Berjon

On Tuesday 30 October 2001 13:16, Geoffrey Young wrote:
> someone ought to come up with Apache::P3P that can manage the P3P header
> generation and has an API for creating the policy file and compact policy
> offline or something.

+1 on that ! If anyone feels like undertaking this task, imho the best first 
step would be to produce XML::P3P (it's not Apache dependent) and add 
Apache::P3P as a wrapper around that that would take care of a few simple 
things such as setting the headers properly and so forth.

-- 
___
Robin Berjon <[EMAIL PROTECTED]> -- CTO
k n o w s c a p e : // venture knowledge agency www.knowscape.com
---
A Priest, a Minister, a Rabbi, a Feminist, an Irishman, an Elephant,
and a Gorilla walked into a bar. The Bartender said, "What is this, 
some kind of joke ?"




Re: [OT] P3P policies and IE 6 (something to be aware of)

2001-10-30 Thread Tatsuhiko Miyagawa

On Tue, 30 Oct 2001 07:16:20 -0500
Geoffrey Young <[EMAIL PROTECTED]> wrote:

> someone ought to come up with Apache::P3P that can manage the P3P header
> generation and has an API for creating the policy file and compact policy
> offline or something.

Apache::P3P is not on CPAN, but is there!
http://www.w3.org/P3P/contributed/nec.co.jp/


--
Tatsuhiko Miyagawa <[EMAIL PROTECTED]>




Re: [OT] P3P policies and IE 6 (something to be aware of)

2001-10-30 Thread Tatsuhiko Miyagawa

On Tue, 30 Oct 2001 02:05:18 +
Mark Maunder <[EMAIL PROTECTED]> wrote:

> my $p3p_compact_policy = "CP=\"ALL DSP COR CURa ADMa DEVa TAIa PSAa PSDa
> IVAa IVDa CONa TELa OUR STP UNI NAV STA PRE\"";
> $r->err_header_out(P3P => $p3p_compact_policy);
> $r->header_out(P3P => $p3p_compact_policy);

mod_headers will do:

  Header add P3P "CP=\"PSA CONi OTR OUR DEM ONL\""

mod_headers
http://httpd.apache.org/docs/mod/mod_headers.html


--
Tatsuhiko Miyagawa <[EMAIL PROTECTED]>




RE: [OT] P3P policies and IE 6 (something to be aware of)

2001-10-30 Thread Geoffrey Young

> Here's how you set up a compact P3P policy under mod_perl:
> 
> #This policy will make IE6 accept your cookies as a third 
> party, but you
> should generate
> # your own policy using one of the apps at the W3C site.
> my $p3p_compact_policy = "CP=\"ALL DSP COR CURa ADMa DEVa 
> TAIa PSAa PSDa
> IVAa IVDa CONa TELa OUR STP UNI NAV STA PRE\"";
> $r->err_header_out(P3P => $p3p_compact_policy);
> $r->header_out(P3P => $p3p_compact_policy);
> 
> Check out http://www.w3.org/P3P/ for the full info on P3P.
> Check out
> http://msdn.microsoft.com/library/default.asp?url=/library/en-
us/dnpriv/html/ie6privacyfeature.asp
>
> for M$ info on IE6 and cookies/privacy
> 
> Appologies for the OT post, but I'm just hoping I'll save someone else
> the same trouble I just went through.

no appologies necessary - I think the people here are always into
cross-browser applications programming...

someone ought to come up with Apache::P3P that can manage the P3P header
generation and has an API for creating the policy file and compact policy
offline or something.

IE6 is going to cause lots of headaches for people - I've heard that cookies
are automatically disabled by default, so the sooner the community is on top
of changes like this the better...

--Geoff



Should i lock DB_File for read-only access?

2001-10-30 Thread Dmitry E. Dmitriev

Hi ALL!

 Should i still lock my dbm files accessed from cgi under mod_perl if i
need only read from them? Not my program nor any others never will write
to
this files.

 I have a problem with code:

 use DB_File;
 use strict;
 my %fields;
 my $fieldsdb='/path/to/db_file';

   some code there 

if (!(tie(%fields, 'DB_File', $fieldsdb, O_RDONLY, 0666, $DB_HASH)))
  {print "Sorry, database access timeout. $!";}

else { 
...other code...

 if (defined($fields{$key})) {print "Field for $key is
$fields{$key}\n";}
 else {print "Field for $key not defined!\n";}

untie %fields;
}

 If i run this code from command line or under mod_cgi, it work fine.
But if it run repeatedly under mod_perl, it occasionally give me a
"database access timeout" message (see code above), but error value $!
still empty. I'm confused:  why error occurred on tie phase, before any
read statements?

The second problem is - even after successful tie()-ing of database
rarely i get "Field not defined!" message for defined keys...
 Dmitry