Re: Advanced daemon allocation

2001-06-28 Thread Trevor Phillips

Matthew Byng-Maddick wrote:
> 
> This is (in my mind) currently the most broken bit of modperl, because of
> the hacks you have to do to make it work. With a proper API for content
> filtering (apache2), it will be fantastically clean, but at the moment... :-(

The hacks are getting neater, but yes, proper content filtering support will be
wonderful. ^_^

> The fastcgi can run in a different apache again, potentially, it doesn't
> matter (unless I'm misunderstanding something you wrote)

I'm not sure you understand how the FastCGI works.
Apache has "mod_fcgi" (or was it mod_fastcgi?) which is a lightweight
dispatcher - it interfaces to FastCGI applications. The FastCGI applications
are separate processes, running as daemons. The handling of the FastCGI daemons
can be done statically (eg; "run 5 instances of this app"), or dynamically
(increase/decrease daemons based on load automatically).

So, if I have an Apache server, with a hefty Perl App that takes up 10Mb RAM,
then an Apache server with 50 daemons would take 500Mb. Having that app as a
FastCGI and limiting it to 5 daemons would mean only 50Mb of RAM is required,
but only 5 of those 50 daemons could access the application at a time - but
those other daemons can do other things, like dish up static content, access
other FastCGIs, etc...

What's more, you can host FastCGI apps on different hosts, and there's a common
protocol between webserver and CGI, so you can write the CGIs in any language,
and have them work with any webserver with FastCGI support.

IMHO, FastCGIs are a better way of doing applications, but don't have the
versatility mod_perl has of digging into Apache internals. Don't get me wrong,
most of what I do is in mod_perl, but part of that is because it's harder to
layer content from multiple FastCGIs.

-- 
. Trevor Phillips -   http://jurai.murdoch.edu.au/ . 
: CWIS Systems Administrator -   [EMAIL PROTECTED] : 
| IT Services   -   Murdoch University | 
 >--- Member of the #SAS# & #CFC# <
| On nights such as this, evil deeds are done. And good deeds, of /
| course. But mostly evil, on the whole. /
 \  -- (Terry Pratchett, Wyrd Sisters)  /



Fix ActivePerl Apache::ProxyPass Bug!

2001-06-28 Thread wac

Dear all

ActivePerl Apache::ProxyPass Module have a bug, 

13 lines
my %cfg = undef;

change it to 

my %cfg;
undef %cfg;

Your Firend,
wac




Re: where to report apache::session 1.53 bug ?

2001-06-28 Thread Tatsuhiko Miyagawa

Hi,

Here are patches I've made ages ago.
http://bulknews.net/lib/archives/Apache-Session-File.pm.patch
http://bulknews.net/lib/archives/Apache-Session-Flex.pm.patch

Thanks

On Thu, 28 Jun 2001 19:15:33 +0700
"Iwan Garnadi" <[EMAIL PROTECTED]> wrote:

> 
> BUG :
> 1. Flex , using Apache::Session::File
> bug in Apache::Session
> TIEHASH method for validate attribute in line 379 :
> &{$self->{validate}}($self);
> I am just commented this to get by pass the error !

--
Tatsuhiko Miyagawa   Livin' On The EDGE, Co.,Ltd.
mailto:[EMAIL PROTECTED] http://www.edge.co.jp/




ANNOUNCEMENT: HTML::Template 2.3

2001-06-28 Thread Sam Tregar

HTML::Template - a Perl module to use HTML Templates

CHANGES

2.3

- New Feature: template tags can now span lines.  (Roland Giersig)

- New Feature: new() option 'filehandle'. (Roland Giersig)

- Bug Fix: includes were broken in some cases using scalarref
   templates. (Lance Thomas)

- Bug Fix: recursive include detection was broken for scalarref
   templates. (Mark Stosberg)

- Bug Fix: cleaned up more 5.004 warnings. (Jere Julian)


DESCRIPTION

This module attempts make using HTML templates simple and natural.  It
extends standard HTML with a few new HTML-esque tags - ,
, , ,  and .
The file written with HTML and these new tags is called a template.
It is usually saved separate from your script - possibly even created
by someone else!  Using this module you fill in the values for the
variables, loops and branches declared in the template.  This allows
you to seperate design - the HTML - from the data, which you generate
in the Perl script.

A Japanese translation of the documentation is available at:

   http://member.nifty.ne.jp/hippo2000/perltips/html/template.htm

This module is licenced under the GPL.  See the LICENCE section of the
README.


AVAILABILITY

This module is available on SourceForge.  Download it at:


http://prdownloads.sourceforge.net/html-template/HTML-Template-2.3.tar.gz

The module is also available on CPAN.  You can get it using CPAN.pm or
go to:

  http://www.cpan.org/authors/id/S/SA/SAMTREGAR/


MOTIVATION

It is true that there are a number of packages out there to do HTML
templates.  On the one hand you have things like HTML::Embperl which
allows you to freely mix Perl with HTML.  On the other hand lie
home-grown variable substitution solutions.  Hopefully the module can
find a place between the two.

One advantage of this module over a full HTML::Embperl-esque solution
is that it enforces an important divide - design and programming.  By
limiting the programmer to just using simple variables and loops in
the HTML, the template remains accessible to designers and other
non-perl people.  The use of HTML-esque syntax goes further to make
the format understandable to others.  In the future this similarity
could be used to extend existing HTML editors/analyzers to support
this syntax.

An advantage of this module over home-grown tag-replacement schemes is
the support for loops.  In my work I am often called on to produce
tables of data in html.  Producing them using simplistic HTML
templates results in CGIs containing lots of HTML since the HTML
itself could not represent loops.  The introduction of loop statements
in the HTML simplifies this situation considerably.  The designer can
layout a single row and the programmer can fill it in as many times as
necessary - all they must agree on is the parameter names.

For all that, I think the best thing about this module is that it does
just one thing and it does it quickly and carefully.  It doesn't try
to replace Perl and HTML, it just augments them to interact a little
better.  And it's pretty fast.


DOCUMENTATION

The documentation is in Template.pm in the form of POD format
perldocs.  Even the above text might be out of date, so be sure to
check the perldocs for the straight truth.


CONTACT INFO

This module was written by Sam Tregar ([EMAIL PROTECTED]) for Vanguard
Media (http://www.vm.com).  You can join the HTML::Template
mailing-list by sending a blank message to
[EMAIL PROTECTED]





apache won't start, strange dynaloader problem...

2001-06-28 Thread Jim Woodgate


sorry if this has been answered before, didn't find anything in the
archives, and I've done this at least half a dozen times before with
no problems.

Mandrake 8.0
apache-1.3.20
perl-5.6.1
mod_perl-1.25

I had problems compiling Apache::Request with the native Mandrake
apache/perl, so I downloaded the latest stable versions and built a
static "flexible" mod_perl httpd (but with DSO enabled in case I want
to add more modules later)

Things seem to work for the most part, but mod_perl is unable to load
modules that have shared libraries.  This the error I get for having
use Apache::Request(); in my startup.pl

[Thu Jun 28 16:04:01 2001] [error] Can't load 
'/usr/contrib/lib/perl5/site_perl/5.6.1/i686-linux/auto/Apache/Request/Request.so' for 
module Apache::Request: libapreq.so.0: cannot load shared object file: No such file or 
directory at /usr/contrib/lib/perl5/5.6.1/i686-linux/DynaLoader.pm line 206.


Request.so is there, and I checked the directories leading up to it
they are all world readable and after a su - nobody (who the web
server runs as) nm Request.so worked fine.  Also the directories under
/usr/contrib are where my versions of perl live.

Running startup.pl with the "normal" intepreter works fine, and I've
seen a similar problem with Image::Magick, so it looks like some
problem with the embedded perl and dynaloader.

Any help would be greatly appreciated!

-- 
[EMAIL PROTECTED]



CGI::Carp(fatalsToBrowser) not working with Apache::PerlRun

2001-06-28 Thread Lee Anne Lester

We are in the process of moving from strictly CGI to a mod_perl environment.
Since I know 
we have many CGI programs that will not run correctly under mod_perl, I want
to run them 
using the Apache::PerlRun handler instead of the Apache::Registry.  We just
have too many 
programs to recode.

I included directives in the httpd.conf file to have all .cgi programs
handled by Apache::PerlRun 
and all .pl files to be handled by Apache::Registry.  The problem I am
having is using
CGI::Carp qw(fatalsToBrowser).  When scripts are run with Apache::Registry,
any fatal errors are 
output to the browser.  When scripts are run using the Apache::PerlRun
handler, the error is going
to the log and not the browser.  I just get Internal  Server Error displayed
in the browser.

Below are the Apache configuration directives and a sample program.  When
the program has a .pl 
extension, I get the error output in the browser.   When the same code is
run with a .cgi extension, 
the error only goes to the log.  Can anyone tell me what I am doing wrong?  

Thanks in advance.

Versions:  Apache 1.3.20   mod_perl 1.25  CGI.pm 2.753  CGI::Carp 1.20


   SetHandler perl-script 
   PerlHandler Apache::PerlRun
   Options ExecCGI
   allow from all
   PerlSendHeader ON



   SetHandler perl-script 
   PerlHandler Apache::Registry
   Options ExecCGI
   allow from all
   PerlSendHeader ON



SAMPLE PROGRAM


#!/usr/local/bin/perl -Tw


use CGI::Carp qw(fatalsToBrowser);
use CGI qw(-debug :standard);
use strict;

use diagnostics;

open(FILE, "


[job] need a perl guru?

2001-06-28 Thread Ivan Kohler

mod_ and regular flavours.

http://420.am/~ivan/resume.html

-- 
meow
_ivan



Re: where to report apache::session 1.53 bug ?

2001-06-28 Thread Vivek Khera

> "GB" == Gunther Birznieks <[EMAIL PROTECTED]> writes:

GB> Most of the time it is really bad to email open source authors
GB> directly.
[ .. ]

GB> That's the job of open forums like this. So the author continues time
GB> to write new updates while the forums basically run themselves with
GB> other people sharing ideas and support.

Then the author should state where to get help, like I do in my
modules.  If not, then I would not necessarily know what the correct
forum for assistance is, would you?

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Vivek Khera, Ph.D.Khera Communications, Inc.
Internet: [EMAIL PROTECTED]   Rockville, MD   +1-240-453-8497
AIM: vivekkhera Y!: vivek_khera   http://www.khera.org/~vivek/



Apache Konfiguration Error 500

2001-06-28 Thread Oliver - GoodnGo.COM \(R\)



Hallo,jetzt habe ich tagelang damit zu gebracht den 
Apache 1.3 zu installieren undzum Laufen zu bringen ... -aber jetzt 
bekomme ich bei perl Skripten die im cgi-bin Verzeichnis vomBrowser aus zum 
Laufe gebracht werden sollen -> die ERROR 500 Meldung.Die Perl 
Skripte liefen auf einer anderen RedHat Linuxmachine problemlos.und konnten 
von jedem Webclient aufgerufen und ausgeführt werden.
Ich denke mal ich habe den Apache falsch 
konfiguriert.
Wie bekomme ich die Perl Skripte zum laufen???Ich bin 
für jeden Hiweis dankbar .

GoodnGo.COM 
Netzwerke Netzwerke 
Programmierung eCommerce Hosting WebWestendstrasse 
2080339 MünchenGermany Fon 
0049 (0)89 54071102 Fax 
0049 (0)89 54071103 e-Mail [EMAIL PROTECTED] 
    Hier geht es zur GoodnGo Auktion Bitte klicken
Bitte folgen Sie 
diesem Hyperlink, wenn Ihr Browser keine 
automatische Weiterleitung unterstützt.Please follow this link, if your browser does not support 
automatic page refreshing.  
  



  Bitte folgen Sie diesem Hyperlink, wenn Ihr Browser keine automatische Weiterleitung unterstützt.
  Please follow this link, if your browser does not support automatic page refreshing.




 





BEGIN:VCARD
VERSION:2.1
N:GoodnGo.COM (R);Oliver -
FN:Oliver - GoodnGo.COM (R)
ORG:GoodnGo.COM;Gefü
TITLE:Geschäftsführung
NOTE:Jederzeit suchen wir Partner- und Affiliateprogramme
TEL;WORK;VOICE:0049 (0)89 54071102
TEL;HOME;VOICE:0049 (0)89 54072045
TEL;CELL;VOICE:0170 2781117
TEL;WORK;FAX:0049 (0)89 54071103
TEL;HOME;FAX:0049 (0)89 54072026
ADR;WORK:;1;Westendstrasse 20;München;Bayern;80339
LABEL;WORK;ENCODING=QUOTED-PRINTABLE:1=0D=0AWestendstrasse 20=0D=0AM=FCnchen, Bayern 80339
URL;HOME:http://www.goodnsearch.com
URL;WORK:http://www.goodngo.com
EMAIL;PREF;INTERNET:[EMAIL PROTECTED]
REV:20010628T161605Z
END:VCARD



Re: API Design Question

2001-06-28 Thread James G Smith

Shawn Devlin <[EMAIL PROTECTED]> wrote:
>Hello all,
>
>I have an CGI based HTTP API (in Perl) to a database and I am now going 
>to port to mod_perl. I am new to this kind of programming and I have a 
>couple of questions. The platform is Linux.

First thing to keep in mind is that CGI and mod_perl are two completely 
different environments.  It is true that Apache::Registry and co. help bridge 
the gap, but there are still things to watch out for even then.  A simple 
one-to-one correspondence in functionality between the two is difficult to 
make and probably will not yield an efficient implementation.

>My first thought is to break the API up so that there is a module per 
>API call (there are some 70 calls in the API). My reasoning is that I 
>can modify existing calls and add new ones without affecting everything 
>else. Does this make sense or is it better to have the API as one large 
>program as I have it now?

If it's an API, I'd not make one module per function, if by function you mean 
a call (e.g., fork() is a function in the Unix kernel API).  Instead, I'd 
group them by functionality (as in OS/2 - VIO, KBD, DOS, ...).  So one module 
might handle customer accounts, another handle news items, etc.

You probably want to analyse your application and do some redesign work at a 
basic level to take advantage of mod_perl.

>My second question pertains to Apache::DBI. I will ask it here but if 
>there is a better forum to ask it please let me know and I will ask it 
>there.  I want to use Apache::DBI in order to cache database 
>connections. If I understand everything that I have read so far (and 
>that might be a big if) the various modules should share the same 
>database connections while running on the same Apache server. Is this 
>correct? I.e. if the API functions 'foo' and 'bar' have both been loaded 
>into the same instance of Apache and both use Apache::DBI then they will 
>share the same database connection.

This should be true.  Connections are maintained on a per-process basis and 
are global within that process.
-- 
James Smith <[EMAIL PROTECTED]>, 979-862-3725
Texas A&M CIS Operating Systems Group, Unix





Re: where to report apache::session 1.53 bug ?

2001-06-28 Thread Iwan Garnadi

in Apache::Session ver 1.53

BUG :
1. Flex , using Apache::Session::File
bug in Apache::Session
TIEHASH method for validate attribute in line 379 :
&{$self->{validate}}($self);
I am just commented this to get by pass the error !

this is below sample of code that cause error :
( Would be in the below of this email )

and error that is shown :
 Global data is not accessible : Can't use string ("") as a subroutine ref
while "strict refs" in use at
/usr/lib/perl5/site_perl/5.005/Apache/Session.pm line 379


2. Apache::Session::Lock::File , clean method got bug in Line 136 !
it is written :
# This would be imposible to clean out lock file that is older than
second  !!!
if ((stat($dir.'/'.$file))[8] - $now >= $time)

 # bla bla bla
}

it suppose to be :
if ( $now - (stat($dir.'/'.$file))[8] >= $time) {
 # bla bla bla
}


CONFIRMATION : ( I am not sure)
1. Apache::Session::Store::File , "seem" doesn't implement locking method
like flock in Apache::Session::Lock::File
when doing "update" an "reading"
How to handle with user that is "opening another browser new windows" and do
the same update ( concurency problem ) !
NB : I maybe wrong in this because I don't read all the source code

Question : I just need to confirm is Apache::Session::File is safe in
concurency problem above ?


SUGGESTION :
1. Apache::Session should implement clean method just like in
Apache::Session::Lock::File, but this time is clean method for "unused
session data"
Because lot of people when doing shopping cart or login session usually
don't
do "sign out" or something like that 
it means impossible to do 'tied(%obj)->delete;' normally in program which
cause session data file like '7bf6117c473f77e791eb33213012d538' still left
in
/tmp/sessiondata !!
this means :
 a. wasting space
 b. slowing down processing in Apache::Session::File etc
I suggest name of method like 'clean_unused_data'


QUESTION :
1. how to implement suggestion number 1 in Apache::Session::File ?
 because I so need this feature immediately ?
 can you give me a quick code for this ?

 or is it safe just doing this code ?

sub clean_unused_data {
my $dir  = shift;
my $time = shift;

my $now = time();

opendir(DIR, $dir) || die $!;
my @files = readdir(DIR);
foreach my $file (@files) {
if ($file =~ /^[a-fA-F0-9]+$/) {
if ( $now - (stat($dir.'/'.$file))[8] >= $time) {
unlink($dir.'/'.$file) || next;
}
}
}
}



Thanks Jeffry
sorry if my english is so poor

=== sample script that is error ==

#!/usr/bin/perl

use Apache::Session::Flex;
use CGI;
use CGI::Carp qw(fatalsToBrowser);;
use Data::Dumper;
use Carp;

#local $| = 1;

my $q = CGI->new;

my ( %session , );
my $cookie_name = 'asid';

my $sid = $q->cookie($cookie_name);
chomp $sid;
print STDERR "[" , scalar localtime , "]\$sid : $sid\n";
my $session_data_directory = '/home/auction/tmp/session';

eval {
 tie %session , 'Apache::Session::Flex', $sid ,
  {
  Store => 'File',
  Lock  => 'Null',
  Generate  => 'MD5',
  Serialize => 'Base64' ,

  Directory => $session_data_directory ,
  LockDirectory => '/home/auction/tmp/session.lock' ,
  #Transaction   => 1 ,
  }
 ;
};
if ($@) { confess "Global data is not accessible : $@"; }


if ($sid) {
 print $q->header;
 print "now asid cookie value : $sid";
 print "now session id : $session{_session_id}";
 print "Previous data : " ; print_data();
 #push(@{ $session{aref} }, 'c');
 my @data_alphabetic = (A..Z,a..z,1..9);
 my @data_random;
 push @data_random , $data_alphabetic[ rand @data_alphabetic ] for (1..8);
 $session{aref} = join '', @data_random ;
 print "Next data : " ; print_data();
#sleep 10;
#tied(%session)->delete;

}else {
 $sid = $session{_session_id};
 $session{aref} = [ 'a' , 'b' ];
 my $cookie = $q->cookie( -name => $cookie_name , -value => $sid );
 print $q->header(-cookie => $cookie ); # , -type=>'text/html' );
 print "Save cookie name '$cookie_name' with value : $sid";
 print "Cookie Value to be stored : "; print_data();
 print "Cookie Value that is get from Apache::Session is : " , Dumper
$session{aref} ;
 print_br();
}
#clean();


sub print_data {
 print Dumper $session{aref} ;
 print_br();
}

sub print_br {
 print "";
}

sub clean {
 opendir(DIR,"$session_data_directory");
 map { print "$_" } grep { $_ !~ /^\.+/ and print -A
"$session_data_directory/$_" , print_br() } readdir(DIR);
 closedir(DIR);
}

=== end sample script that is error ==





API Design Question

2001-06-28 Thread Shawn Devlin

Hello all,

I have an CGI based HTTP API (in Perl) to a database and I am now going 
to port to mod_perl. I am new to this kind of programming and I have a 
couple of questions. The platform is Linux.

My first thought is to break the API up so that there is a module per 
API call (there are some 70 calls in the API). My reasoning is that I 
can modify existing calls and add new ones without affecting everything 
else. Does this make sense or is it better to have the API as one large 
program as I have it now?

My second question pertains to Apache::DBI. I will ask it here but if 
there is a better forum to ask it please let me know and I will ask it 
there.  I want to use Apache::DBI in order to cache database 
connections. If I understand everything that I have read so far (and 
that might be a big if) the various modules should share the same 
database connections while running on the same Apache server. Is this 
correct? I.e. if the API functions 'foo' and 'bar' have both been loaded 
into the same instance of Apache and both use Apache::DBI then they will 
share the same database connection.


Thanks.

Shawn

-- 
This communication is intended to be received by the individual or
entity to whom or to which it is addressed and it contains information
that is privileged, confidential and subject to copyright of 
Recognia Inc. Any unauthorized use, copying, review or
disclosure is prohibited. If received in error, please contact me by
phone at 613-623-6159 or by email at mailto:[EMAIL PROTECTED].