Re: cgi.pm does not work in handlers (why responsehandlers at all ?)

2003-04-02 Thread pilsl
thnx for your reply.
 
I use mod_perl 2 (1.99_08) and CGI.pm 2.91 and Apache 2.0.44.  I thought that CGI.pm
wouldnt work at all, so I didnt give any examples.
 
I wrote a simply script that checks if running under mod_perl,
displays some parameter and evaluates/presents a form.
 
This script (source below) I implement as simple mod_perl-script one time and as
PerlResponseHandler the other time. As sole mod_perl-script it works
perfect, while as Handler:

*  it fails to read the path_info and the CGI-params.

* The startform-method needs an explicit action-argument or it will post
the form to the (nonexisting) url '/e'. 

* The cgi-header() method causes an error.  Can't call method
send_cgi_header on an undefined value at (eval 6) line 60.. 

* And I cant just print out but need to use the $r-print-method.

So my conclusion was/is that CGI.pm does just not work inside an apache-handle.



For the docs of mod_perl-handlers I read perl.apache.org, but I
couldnt find any tutorials about writing handlers in
mod_perl. Especially a description about the methodes and values of
the responsehandler-object. 

thnx a lot, peter


the source:



  
A) the handler


accessed via http://localhost/time

 
apache-config
PerlModule goldfisch::apache::random
  Location /time
  SetHandler modperl
  PerlResponseHandler goldfisch::apache::random
  /Location



package goldfisch::apache::random;

use 5.008;
use strict;
use warnings;
use Apache::RequestRec ();
use Apache::RequestIO ();
use Apache::Const -compile = qw(OK);
use CGI;

sub handler {
  my $r = shift;
  $r-content_type('text/html');

  my $q=new CGI;
  my $html='';
#  $html.=$q-header(-charset='utf-8',-expires='now');
  $html.='!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 
Transitional//ENHTMLHEADtitletestgoldfisch/title/HEAD';
  $html.=GOLDFISCH.int(rand(1000)).br;
  my $mp='no'; $mp=$ENV{MOD_PERL} if(exists $ENV{MOD_PERL});
  $html.=running under modperl : .$mp.br\n;

  $html.='parameters delivered to the script : br';
  my @k=$q-param; foreach(@k) { $html.=$_ = .$q-param($_).br\n;}
  $html.='--br';

  $html.=path_info CGI = .$q-path_info().br\n;
  $html.=path_info handler = .$r-path_info().br\n;

  $html.='brbr';
  
$html.=$q-startform(-action='/time').$q-textfield(-name='test',-size=50).$q-submit(-value='press').$q-endform();$q-end_html;
 
  
  $r-print($html);
  return Apache::OK;
}

1;



B) the mod_perl-script:

accessed via http://localhost/random


Alias /random /home/htdocs/perl/random.pl
Files ~ \.pl$ 
  SetHandler perl-script
  PerlResponseHandler ModPerl::Registry
  Options +ExecCGI
/Files



#!/usr/bin/perl -w
# mod_perl

use strict;
use warnings;
use CGI;

my $q=new CGI;
my $html='';
$html.=$q-header(-charset='utf-8',-expires='now');
$html.='!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 
Transitional//ENHTMLHEADtitletestgoldfisch/title/HEAD';
$html.=GOLDFISCH.int(rand(1000)).br;
my $mp='no'; $mp=$ENV{MOD_PERL} if(exists $ENV{MOD_PERL});
$html.=running under modperl : .$mp.br\n;

$html.='parameters delivered to the script : br';
my @k=$q-param; foreach(@k) { $html.=$_ = .$q-param($_).br\n;}
$html.='--br';

$html.=path_info CGI = .$q-path_info().br\n;
$html.=path_info handler = .$r-path_info().br\n;

$html.='brbr';
$html.=$q-startform(-action).$q-textfield(-name='test',-size=50).$q-submit(-value='press').$q-endform();$q-end_html;
 

print $html;






ps : sorry for this long posting,




On Wed, Apr 02, 2003 at 09:10:17AM +1000, Stas Bekman wrote:
 [EMAIL PROTECTED] wrote:
 
 I used CGI.pm in my mod_perl-application to get 'path_info', 'param',
 print out headers and more.
 None of this works inside my own handlers any more.
 
 Which mod_perl generation are you using? mod_perl 1.0 (1.27?) or mod_perl 
 2.0 (1.99_08?). I suspect that you use mp2, since you mention later 
 ResponseHandler, which doesn't exist in mp1. If that's the case, are you 
 using the latest CGI.pm version? (older versions are known not malfunction 
 with mp2).
 
 If after getting the latest versions you still have problems, please post a 
 *simple* several lines handler/script which doesn't work for you. Asking 
 *why* CGI.pm doesn't work, is similar to asking why my car doesn't move 
 from its place ;) You have to be more specific and then we will be able to 
 figure out, what the problem is.
 
 - whats the maineffect of a simple ResponseHandler at all compared
 with a perl-program run under mod_perl ? Is it much faster, cause it
 handles things more efficiently ? By now I used to use an
 Alias-Directive in apache to direct certains requests to a single
 perl-script and use path_info() to detect the additional
 arguments. For the use there is no difference at all.
 
 If you are talking about perl-scripts running under Apache::Registry or 
 Apache::PerlRun, you are in fact running response handlers. The scripts are 
 converted to such behind the scenes. In addition registry scripts do a few 
 more things, which slow things down just a tiny-bit, probably 

[OT] Perfomance tests, How?

2003-04-02 Thread Ruslan U. Zakirov
Hello All!
  I need to test my project perfomance. Is there any OpenSource
projects like WebBench and other in the Internet?
 Best regards. Ruslan.



AW: [OT] Perfomance tests, How?

2003-04-02 Thread Denis Banovic
Hi!

Here are the doc's:

Try ab or http_load.

http://perl.apache.org/docs/1.0/guide/performance.html


Best regards



Lust auf mehr? - http://maedls.at
---
NCM - NET COMMUNICATION MANAGEMENT GmbH
---[  Denis Banovic - CTO
mailto:[EMAIL PROTECTED]
---[  Mühlstrasse 4a
  AT - 5023 Salzburg
  Tel. 0662 / 644 688
---[  Fax: 0662 / 644 688 - 88 


-Ursprüngliche Nachricht-
Von: Ruslan U. Zakirov [mailto:[EMAIL PROTECTED]
Gesendet: Mittwoch, 2. April 2003 14:54
An: mod_perl list
Betreff: [OT] Perfomance tests, How?


Hello All!
  I need to test my project perfomance. Is there any OpenSource
projects like WebBench and other in the Internet?
 Best regards. Ruslan.


Re: [OT] Perfomance tests, How?

2003-04-02 Thread Nathan Byrd
On Wed, 2003-04-02 at 06:54, Ruslan U. Zakirov wrote:
 Hello All!
   I need to test my project perfomance. Is there any OpenSource
 projects like WebBench and other in the Internet?
  Best regards. Ruslan.

You might also want to try HTTPD::Bench::ApacheBench.  I just finished
using it for doing some performance testing for a module I'm developing
and it worked great, seems to have good reporting methods and options
for repetitions, concurrency, etc.  Thanks,


-- 
Nathan Byrd [EMAIL PROTECTED]



Configuration with perl

2003-04-02 Thread Richard Clarke
I'm fairly sure my head is about to explode from frustration here. Any help
would be MUCH appreciated.

I'm trying to get my httpd.conf working with perl../perl, however things
don't seem to be working out.
As soon as I add either $PerlModule or $PerlRequire for any module, apache
seems to try load/bind/or something, itself twice?

[Wed Apr  2 21:52:50 2003] [warn] VirtualHost 10.10.10.1:3128 overlaps with
VirtualHost 10.10.10.1:3128, the first has precedence, perhaps you need a
NameVirtualHost directive
[Wed Apr  2 21:52:50 2003] [warn] VirtualHost 10.10.10.2:3128 overlaps with
VirtualHost 10.10.10.2:3128, the first has precedence, perhaps you need a
NameVirtualHost directive
[Wed Apr  2 21:52:50 2003] [crit] (48)Address already in use: make_sock:
could not bind to address 10.10.10.2 port 3128

This happens no matter where in the file or what in order I put these
directives.

Did I make a massive oversight when reading the documentation on this?


Richard.




How to make apache with both mod_perl and mod_ssl?

2003-04-02 Thread Charlie Smith
How to make apache with both mod_perl and mod_ssl?

--
This message may contain confidential information, and is intended only for the use of 
the individual(s) to whom it is addressed.


==



Re: [mp2] upload file

2003-04-02 Thread Stas Bekman
I used of examples these 2 archives
but dont functioned
in mp1 i dont have problem

my mp2 version is last cvs version
So you have a problem with mp2. Did you upgrade your CGI.pm to the latest version?

__
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: cgi.pm does not work in handlers (why responsehandlers at all?)

2003-04-02 Thread Stas Bekman
[EMAIL PROTECTED] wrote:
thnx for your reply.
 
I use mod_perl 2 (1.99_08) and CGI.pm 2.91 and Apache 2.0.44.  I thought that CGI.pm
wouldnt work at all, so I didnt give any examples.
 
I wrote a simply script that checks if running under mod_perl,
displays some parameter and evaluates/presents a form.
 
This script (source below) I implement as simple mod_perl-script one time and as
PerlResponseHandler the other time. As sole mod_perl-script it works
perfect, while as Handler:
[...]
apache-config
PerlModule goldfisch::apache::random
  Location /time
  SetHandler modperl
This is your problem. CGI.pm relies on things like Apache-request and env 
vars, neither of which is available under 'SetHandler modperl'. Change it to 
'SetHandler perl-script' and read:
http://perl.apache.org/docs/2.0/user/config/config.html#C_SetHandler_



__
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: How to make apache with both mod_perl and mod_ssl?

2003-04-02 Thread Stas Bekman
Charlie Smith wrote:
How to make apache with both mod_perl and mod_ssl?
RTFM:
http://perl.apache.org/docs/1.0/guide/install.html#Installation_Scenarios_for_mod_perl_and_Other_Components


__
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


ANNOUNCE: Bricolage-Devel 1.5.2

2003-04-02 Thread David Wheeler
The Bricolage team is pleased to announce the release of Bricolage-Devel
1.5.2, a release candidate for what will soon become Bricolage
1.6.0. Users of 1.5.1 are strongly encouraged to upgrade to 1.5.2, as
assets have an unfortunate habit of disappearing from workflow in 1.5.1.
In addition to all of the new features and bug fixes from the 1.5.0 and
1.5.1 releases, this version of the open-source content management
system fixes several significant bugs and tweaks a few important
features. The most significant changes include:
*   Out of the box, the Story Editors, Media Producers, and Template
Developers groups now have READ permission to access members of
the All Categories and All Elements groups, which allow them
to actually create assets based on elements and within
categories.
*   Workflow and Desk permissions are a little more sensible
now. CREATE permission can be granted for the start desk in each
workflow, instead of for the entire workflow. This allows a
lower permission to be set on the workflow (e.g., READ), and
then higher permissions on the individual desks in the workflow.
*   New Tuning sections have been added to Bric::DBA.

*   The default required length for usernames and passwords has been
changed from 6 to 5. This is to make dealing with the default
admin login easier.
*   It is once again possible to delete elements when they are not
associated with any story or media asset.
*   Bric::Config now does its best to find a workable httpd.conf 
file
during make test.

*   Previews of assets that are not checked out work again.

*   Workflow and desk permissions relative to the assets they
contain are now restored to their previous behavior. Desks no
longer simply inherit the permission granted on any of the
workflows they're in. This issue was resolved by creating a new
secret asset group ID for each workflow.
*   Assets will no longer appear to randomly disappear from
 workflow.
For a complete list of the changes, see the changes file at
http://sourceforge.net/project/shownotes.php?release_id=150544. Although
this release gives every appearance of being as stable as any previous
release of Bricolage, it does contain a fair bit of new code that needs
to be put through the ringer. It is, however, feature complete for
1.6.0, which we expect to release in the second week of April.
ABOUT BRICOLAGE

Bricolage is a full-featured, enterprise-class content management and
publishing system. It offers a browser-based interface for ease-of use,
a full-fledged templating system with complete HTML::Mason and
HTML::Template support for flexibility, and many other features. It
operates in an Apache/mod_perl environment, and uses the PostgreSQL
RDBMS for its repository. A comprehensive, actively-developed open
source CMS, Bricolage has been hailed as Most Impressive in 2002 by
eWeek.
Learn more about Bricolage and download it from the Bricolage home page,
http://bricolage.cc/.
Enjoy!

--The Bricolage Team



Re: Configuration with perl

2003-04-02 Thread Richard Clarke
List,
No matter what I can't understand why the following tiny perl
configuration won't work.
If I comment out $ServerRoot, it works. If I instead comment out
DocumentRoot, it works.
If I comment out $$l, it works. I don't understand :(

Perl
#!perl -w

$ServerRoot = /usr/local/app/apache_modperl;
$DocumentRoot   = /usr/local/app/static;

$PerlRequire= /usr/local/app/conf/startup.perl;

foreach my $l (qw/ErrorLog TransferLog LockFile PidFile ScoreBoardFile/) {
 $$l  = /usr/local/app/apache_modperl/logs/$l;
};

$VirtualHost{10.10.10.42:3128} = {
ServerName = mp2.local.com
   };

/Perl


startup.perl only contains,
#!/usr/bin/perl -w
use strict;

use lib qw (/usr/local/app/lib);

1;


PERL_TRACE output clearly shows that half of the perl section is being
processed twice, causing a VirtualHost overlap warning.
Is it supposed to work like this?

Richard.



Adding / Modifing Response Headers on mp2

2003-04-02 Thread Denis Banovic
Hi!

I'm trying to figure out, how to Add / Modify the HTTP Headers like
Content Type, Cache aso...

on mod_perl 1 I've used:
 
$r-send_cgi_header($custom_headers);

but this won't work mod_perl 2...

I've searched in Apache::compat all I've found was the function header_out
that internally calls $r-headers_out()... 

Can somebody please tell me how to set the right headers???

Thanks a lot!


here is the code from Apache::compat


sub table_get_set {
my($r, $table) = (shift, shift);
my($key, $value) = @_;

if (1 == @_) {
return wantarray() 
?   ($table-get($key))
: scalar($table-get($key));
}
elsif (2 == @_) {
if (defined $value) {
return wantarray() 
?($table-set($key, $value))
:  scalar($table-set($key, $value));
}
else {
return wantarray() 
?   ($table-unset($key))
: scalar($table-unset($key));
}
}
elsif (0 == @_) {
return $table;
}
else {
my $name = (caller(1))[3];
warn Usage: \$r-$name([key [,val]]);
}
}

sub header_out {
my $r = shift;
return wantarray() 
?   ($r-table_get_set(scalar($r-headers_out), @_))
: scalar($r-table_get_set(scalar($r-headers_out), @_));
}